Load gameobject ignoring instance id
Posted: Fri May 10, 2019 11:28 pm
Hi. I just purchade EasySave hours ago.
I wrote a little script to save and load a gameobject that have a script with an scriptable object and some other values.
The save is working good, but when I try to "loadinto" another gameobject (B), it doesn't load the script component attached, but change the name of the gameobject (B) and the tag, and it load the information in the main gameobject.
If i delete the main gameobject, EasySave creates a new gameobject called "Easy Save 3 Loaded GameObject", instead of loading the information in the gameobject (B) i use as an argument in the loadinto function.
The Save and load script is this:
The thing i need is to save the script component information in the gameobject and load it in any other gameobject, even in other scene. How to do that?
Any help please? Thanks in advance.
I wrote a little script to save and load a gameobject that have a script with an scriptable object and some other values.
The save is working good, but when I try to "loadinto" another gameobject (B), it doesn't load the script component attached, but change the name of the gameobject (B) and the tag, and it load the information in the main gameobject.
If i delete the main gameobject, EasySave creates a new gameobject called "Easy Save 3 Loaded GameObject", instead of loading the information in the gameobject (B) i use as an argument in the loadinto function.
The Save and load script is this:
Code: Select all
public class Manager : MonoBehaviour
{
GameObject player;
GameObject newPlayer;
void Start()
{
player = GameObject.FindGameObjectWithTag("LeoPlayer");
newPlayer = GameObject.FindGameObjectWithTag("NewPlayer");
}
public void LeoSave() {
ES3.Save<GameObject>("leoPlayer", player);
Debug.Log("Saved");
}
public void LeoLoad() {
ES3.LoadInto<GameObject>("leoPlayer", newPlayer);
Debug.Log("Loaded");
}
}
Any help please? Thanks in advance.