Skip to content

[Bug]: 持久化Entity跨场景保留问题 #481

@Will-Z666

Description

@Will-Z666

问题描述 / Bug Description

上一个场景的持久化实体,下一个场景在未切换之前创建实体,就会因为id相同无法保留

复现步骤 / Steps to Reproduce

1.在A场景创建一个持久化Entity,id是65536.
2.创建场景B,在初始化或system的onInitialize里批量创建一批entities ,这时id也是65536开始
3.切换场景B,调用B的receiveMigratedEntities,就会因为id已经存在了,A的持久化Entity就没有合并过来。

期望行为 / Expected Behavior

持久化实体正常保留

实际行为 / Actual Behavior

持久化实体未保留,出现bug

版本 / Version

2.11.1

平台 / Platform

Cocos Creator

环境信息 / Environment

  • OS:
  • Browser:
  • Node.js:

代码示例 / Code Sample

错误日志 / Error Logs

检查清单 / Checklist

  • 我已经搜索过类似的 issue / I have searched for similar issues
  • 我使用的是最新版本 / I am using the latest version
  • 我愿意提交 PR 修复此问题 / I am willing to submit a PR to fix this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions