Author Topic: TANKGAME: BAD NEWS!!  (Read 3413 times)

I can save, load and serialize. I just needed to know if you can save an entire object and all of its children/components. Pretty much the same way as a prefab works (so that I don't have to serialize every little variable in the game).

Do you mean actual gameobjects in the scene? It's possible, 'Unity Serializer' used to do that (but has since died). I don't understand why you would want to do that as opposed to just using prefabs. Can you describe what you're trying to use it for?

Yes, actual game objects in the scene (such as enemies and the player). I am trying to make a save and load feature (so the player can save and jump right in to where they left off) and I'm having quite a lot of trouble. I haven't tried much with serialization and it's bugging me a lot.

So I would need to serialize the whole object (transform position/rotation, children and components and variables such as health and clip rounds for the passenger)

I would advise against trying to serialize whole gameobjects. It's not supported by most serialization packages for good reason - you will be serializing a hell of a lot of information that you don't need for each object.

For each gameobject there will only be a limited number of things you actually need. Say for an enemy unit, you might want to serialize position, rotation, turret rotation, health and ammo. You can serialize these in a separate serializable non-monobehaviour class. When you rebuild your scene, you spawn your enemies from their prefab like usual, deserialize their data and pass through their parameters to restore their state.

It's more work (as far as programming is concerned), but it will be faster and result in less storage space being used.

OK, Thanks for the advice. I should really write a list of what needs to be serialized as I go (should of done that ages ago).

A Quick Update:

I managed to find the Unity Serializer for Unity 5, so I might have a save and load feature in the next update.
I have created an automatic aspect ratio finder for the game so it will no longer ask if you have an android phone or tablet.


Unfortunately the serializer is broken which means a big delay in the release of a save and load feature and a small(ish) delay in the performance update release, although I have managed to complete the performance mode option and I have polished the options menu to look like the shop menu. I will begin working on a serializer of my own (save and load script) and will work on this as I update, this means that updates for the game will probably be released later than expected.

Whats Next:
  • A scaler for the user to make their GUI larger

If you would like to see any other performance related additions/fixes, say it now!
« Last Edit: October 09, 2015, 04:01:49 AM by Tom060197 »