I am instantiating game objects like this
GameObject go = Instantiate(Resources.Load("Prefabs/AIBlob")) as GameObject;
BlobController aiBlob = go.GetComponent("BlobController") as BlobController;
aiBlob.init(size);
Debug.Log("created blob, "+aiBlob.transform.position+" energy="+aiBlob.physicalState.energy);
This outputs that energy has been set to a value like 1.
Then, when Update() is called on this game object, physicalState.energy is 0. Why is that happening? Why are these variables getting reset? I noticed that Start() also gets called AFTER init() here… and when Start() gets called physicalState.energy is 0. Why???
Anyone know what I’m talking about?
Thanks for your help!
EDIT I also have code that should not be run unless objectA.getInstanceID() == objectB.getInstanceID()
and then in the code that should not get run if those two IDs are the same, I can output them, and they are always both the same negative number. are getInstanceID() supposed to be 0? Is my Unity broken? Wtf???