Why unity tries to save clean assets?
Hello everyone!
I have some procedural generatioin code that cahnges prefab from inside. I call EditorUtility.SetDirty on objects wich I change and all is working fine but when I Press Ctrl + S to save something else (for example scene), Unity tries to resave some of these prefabs also if they are not dirty (In git it looks as changed EOLs). Through a code I found that EditorUtility doesn't think that these prefabs are dirty, but editor tries to save them.
Also there is one more strange behaviour: For one Ctrl+S event it runs many saving calls: first of all unity tries to save all these assets but than it starts to itertate through prefabs and try to save each independently.
May be important: it tries to save prefabs that are reffered by other objects (in scene or scriptables).
I'd like to prevent this behaviour and find what I'm doing wrong. Please, help with the direction where I should look.
Answer by djexstas9 · Jun 11, 2020 at 10:34 AM
Answer is: I used OnValidate in one place to flip values and smehow didnt't make "HasChanged" wraping but straightly was setting values every frame, so when I wrote "HasChanged" wrapping, problem has gone
Your answer
Follow this Question
Related Questions
Asset database creation problem 0 Answers