Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

instantiate 节点时,普通成员变量,和被@property注释的成员变量,行为不一致 #17838

Open
iiiron opened this issue Nov 11, 2024 · 0 comments
Assignees
Labels
Bug Needs Triage Needs to be assigned by the team

Comments

@iiiron
Copy link

iiiron commented Nov 11, 2024

Cocos Creator version

3.8.4

System information

All

Issue description

在Node中声明了两个变量,一个是被@Property注释的变量,一个是普通成员变量
image

如下图,在instantiate节点前,进行成员变量的修改。instantiate后的结果中,被@Property注释的变量,在克隆体中是新值,而普通成员变量,在克隆体中还是旧值
image
image

这看起来是个bug,如果不是Bug,instantiate确实是这样设计的,那在官方文档中应该说明一下

Relevant error log output

No response

Steps to reproduce

snapshot() {
this.isOriginSeed = false
this.purchasePrice = 10

    this.seedOriginal = instantiate(this.node)
    console.log(this.seedOriginal)
}

Minimal reproduction project

No response

@iiiron iiiron added Bug Needs Triage Needs to be assigned by the team labels Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Needs Triage Needs to be assigned by the team
Projects
None yet
Development

No branches or pull requests

2 participants