#Editor value not saving
1 messages · Page 1 of 1 (latest)
Are you able to share both classes? You can use this to share the code https://gdl.space/
so if i write on that page you see it?
Can you share the MonoBehaviour and the editor script? You can use this to share the code https://gdl.space/
ok i did it
there are 4 classes, first two are the monos (one is inhereted from other). And the other 3 are editor, (one inherited from other)
You are not serialising your fields
uh, ok right. Can I ask why the are not just serialized automatically like how floats are when you set it public.
OHHH its because they are private isn't it?
Yes, only public field and private fields with the [SerializeField] attribute are serialized by Unity
I would still recommend using Undo over SetDirty
Btw @amber mist for future reference in case you didn't already realize it.
It is against the #📖┃code-of-conduct to @ people not involved in the conversation. Also just in general in public discord servers it is normally considered a taboo/rude thing to do.
Just the heads up for next time 🙂
Oh I didn't know that ok I am so sorry. But I did delete the @ when you responded. But yeah sorry
I will look into it thanks
So I added
Undo.RecordObject(ui, "Setting Up And DOwn");
but even though it does undo for the ui.up variable, it doesn't call the .Up method which means it doesn't undo the spriterenderer.sprite back to what it was before
The renderer needs to be dirtied separately, as with SetDirty not calling the renderer changes made to it will not persist
If you change an object through a method or property without dirtying it that change is transient
So you want me to set the renderer dirty? I thought I shouldn't use setDirty.
I did it but it didn't work unfortunately