Open ze0nni opened 3 months ago
When you change MyBytton.string and focus to another place editor will mark as dirty and the title will have change to xx.scene*
but if you want to know your text change event at inspector, you can use getter and setter as you provided and just add @executeInEditMode
decorator
//add this decorator and this component will run on editor and you can use you setter and getter when on editor mode
@executeInEditMode
export class testComponent extends Component {
@property(MyText)
private _text: MyText;
@property(CCString)
get string(): string { retunr this._text.string; }
set string(value: string) { this._text.string = value; }
}
Tried create minimal project to reproduct bug. But No problem not reproduced.
I think the problem is in my project. This is what it looks like: https://www.youtube.com/watch?v=vJX2dJir9M8
I will research problem more
or you can upload a simple demo and we will try this https://www.youtube.com/watch?v=vJX2dJir9M8
Success. This happens if you use prefabs
Use Case
I am create component, who provides access to other compoent data.
Like this:
Problem Description
This is work good in play mode.
I have problem in edit mode: Then I change MyBytton.string in editor inspector, I see how text changed in MyText. But then I save prefab -- MyText нет saved. I understand that I need to mark the component as "dirty" but I couldn't find how.
I saw there is a flag
CCObject.Flags.Dirty
and use it like this:But no result
Proposed Solution
No response
How it works
No response
Alternatives Considered
Avoid to complex components?
Additional Information
No response