You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am create component, who provides access to other compoent data.
Like this:
class MyBytton {
@property(MyText)
private _text: MyText;
@property(CCString)
get string(): string { retunr this._text.string; }
set string(value: string) { this._text.string = value; }
}
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:
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
@executeInEditModeexportclasstestComponentextendsComponent{
@property(MyText)private_text: MyText;
@property(CCString)getstring(): string{retunrthis._text.string;}setstring(value: string){this._text.string=value;}}
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
The text was updated successfully, but these errors were encountered: