store a gameobject ?

Hi everyone !

I started developping on unity just a few weeks ago so there’s probably a way to do it but I can’t figure it out 'till now.

My probleme is that I want to store a gameObject from the hierarchy into a MySql database and eventualy load it back later.
It’s ok for the connection to the database the probleme is how do I store a gameobject in it.

Thank you for answering.

PS : I use C#

It seems that you are looking for a serializer. A good, free one that is already programmed is the Unity Serializer (http://whydoidoit.com/unityserializer/).

Try this tutorial:

http://wiki.unity3d.com/index.php?title=Saving_and_Loading_Data:_XmlSerializer

The thing is that is going to save particular components of your game object. You can decide to serialize any component attached to your game objects. Just keep in mind that the serialization cannot occur on any class that inherit from Monobehavior, so be wise on how to define your components.

Here’s a workaround to serialize a MonoBehavior class:

Regards