Saving runtime objects and general advice

Easy Save 2 has been replaced by Easy Save 3, so is no longer supported.
Locked
Velo222
Posts: 3
Joined: Sun Jan 19, 2014 5:48 am

Saving runtime objects and general advice

Post by Velo222 »

Hello,

I am pretty new to the whole "enterprise" of saving and loading a game with Unity. My expectation was that I could simply click a button, and Easy Save 2 would save all of my scene game objects to a file, and then I could click another button and have them loaded -- and be done. Obviously, this is not the case (at least I think).

What is kind of the general practice way of saving a Unity scene? For example, do I need to place "save code" on all of my game objects and then when the player presses a button to save a game, I have to iterate through all of the objects to save that game object or component? Why is the "GameObject" type NOT supported? It sounds like I have to instantiate a pre-made prefab, then load all of the objects components individually (in addition to the transform) -- is that actually what needs to happen?

I am also using the UMA system from Unity (Unity multi-purpose avatars), and they are objects that are completely created at runtime, which means I have no prefab for them. If I don't have a prefab for these UMA characters, is there a way for me to be able to save and load them?

I know some of this is hard to answer due to the nature of saving and loading and how each person's game is different, but I'm trying to wrap my head around how to save and load with this system.

Thank you for your time and any advice you can give.
User avatar
Joel
Moodkie Staff
Posts: 4988
Joined: Wed Nov 07, 2012 10:32 pm

Re: Saving runtime objects and general advice

Post by Joel »

Hi there,

It's not possible to save entire scenes and GaneObjects automatically as they can be extremely complex (most of which won't need persisting), and there's some things within a scene that Unity doesn't provide us with a way if serialising.

A basic workflow is to work out what variables in the scene change, and thus will need persisting. For example, if the players position changes, you should call ES2.Save on the player Transform's position when the scene exits, and ES2.Load it when the scene loads.

There is also Auto Save, which is our code free solution which is currently in beta which may be helpful to you: http://docs.moodkie.com/easy-save-2/guides/auto-save/

For information on saving/loading using C#/UnityScript, we have a fairly comprehensive set of guides here: http://docs.moodkie.com/product/easy-save-2/

There are also tutorials in the Tutorials and Examples section of this forum.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Locked