Hi there,
Here is my problem. I’m using Resource.Load to load GameObjects to my scene and i put those objects in a List and i need to find objects in that List so in order to find the correct objects i use GetInstanceID that is supposed to be unique but all the objects that i get using Resource.Load has the same InstanceID.
According to the manual every gameObject clone should have an unique InstanceID, also if a i put the inspector in debug mode every object has different InstanceID but in the code GetInstanceID is returning the same ID.
Any idea??
I have never used GetInstanceID
before and perhaps if I knew it existed sooner I wouldn’t have used this solution instead…
enemyInstance.name = enemyPrefab.name + count++;
When I instantiate an enemy I just increment the name so they are always unique. Then you can access them via normal methods. Not sure if this is actually what you are talking about though since you say you are using Resource.Load
and don’t mention instantiate. However if you have multiple clones of an object in a list then incrementing the names does work.
Thanks for the answer. I’m using GUID as unique id since InstanceID is not unique but and incremental name should do the trick to.
My post is more about wondering if some one has seen a similar behaviour or if i stumble with bug (i’m almost sure is a bug) may be the post isn’t clear enough on what i expect but i surely appreciate the help.