Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  How to Save / Load Obi Actors in 5.0
#15
(27-10-2020, 10:51 AM)Elegar Wrote: Nope, It doesn't work. I already tried. Calling SaveAssets changes nothing. Also, as I already wrote, I clicked "File -> SaveProject" which does the same.

Precisely speaking, it doesn't save after I commented out "GenerateImmediate();". And I don't understand why. Before removing that line saving worked but rope reset after validate.

Have you tried flagging the asset as dirty using EditorUtility.SetDirty(blueprint); before calling SaveAssets? This is automatically called right after GenerateImmediate() (since it regenerates all blueprint data, so it's always known to need saving after this operation) but not called in any other case, such as manual editing of blueprint data or saving to the blueprint at runtime, as we don't know if/when the user has modified the asset.

Anytime you modify an asset, you should flag it as dirty (so that the asset database knows something has changed, and needs writing to disk), then call SaveAssets(). This will cause Unity to iterate over all assets that have been flagged dirty, save them to disk, then clear the dirty flag.

See: https://docs.unity3d.com/ScriptReference...Dirty.html
Reply


Messages In This Thread
RE: How to Save / Load Obi Actors in 5.0 - by josemendez - 27-10-2020, 12:04 PM