Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  How to Save / Load Obi Actors in 5.0
#9
(25-10-2020, 09:51 PM)Elegar Wrote: Hi Jose!
Thank you for great solution for loading/saving the blueprints! I've digged half of the forum and finally found it hereSonrisa
It is almost what I need except one point: seems that it saves only in memory and keep them while game is running. But how can I save it permanently?
I want to edit my ropes in runtime (I'd like to make some kind of knots and it is quite difficult to achieve using the editor) and then save them to disk. I tried to save ropes as prefabs but this keeps bluprints unmodified. Do you have any solution for this case?

Hi there!

In Unity you can't create/serialize new blueprints at runtime, you can only create new blueprints while in editor.

So you do this the same way as you'd serialize any data to disk, such as game progress or user info: pick the binary/text format of your choice (json, xml, or roll your own if the need strikes), then use any API you like to write this file to disk. There isn't any specific way to do this in Obi, or Unity, as there isn't in any engine afaik. You're free to decide how to make your data persistent.

Unity has built-in json support, that will automatically serialize/deserialize objects for you. This simplifies things considerably but still, you need to do this by yourself:
https://docs.unity3d.com/ScriptReference...ility.html

https://www.raywenderlich.com/418-how-to...e-in-unity
Reply


Messages In This Thread
RE: How to Save / Load Obi Actors in 5.0 - by josemendez - 26-10-2020, 08:25 AM