Sorry if this was already answered/noob question, but, unfortuantely, I can’t seem to find much information on how to use the instance ID effectively.
I have a gameObject set as a prefab during runtime that I am attempting to save as part of a .json by converting the unique instance ID of the instantiated object into a string. I think I am doing this correctly as far as saving the information goes, but the problem arises when trying to assign that saved reference point as a game object upon loading into the scene.
My question is: Is there a way I can use this saved string of the object’s instance id to assign it as a declared ‘Game Object’ variable in script, and if so, how would I go about it? Was looking through, but couldn’t find a way to set it.
Here’s a snipit of my code:
public void Load_Player()
{
Saveable_Object_Player savedata = Save_Manager.Load_Player_Stats();
for (int i = 0; i < PlayerDeck.Length; i++)
{
PlayerDeck <em>= savedata.Prefab_Cards_in_Deck_Instance_IDs*;*</em>
}
}
I’m pretty sure using ‘GameObject.name =’ won’t work, but I’m not sure what else would be used here as I can’t assign a GameObject variable to equal to a string, and I’m not sure how to implicitly convert it properly. Is there a component I can use for the GameObject variable here to set the reference the prefab id (that was converted to string)?