- Home /
Instantiated GameObject being deleted when destroying original
This seems absolutely crazy, and I cant figure it out. I have a gameobject that i instantiate on GetMouseButtonDown. I created it like this :
tempStreetLamp = Instantiate(lampinstance) as GameObject;
Then when GetMouseButtonUp is triggered, I move it to a new gameobject, and destroy the original, like this:
permamentStreetLamp = Instantiate(tempStreetLamp) as GameObject; Destroy(tempStreetLamp);
for testing purposes, I changed the name of permanent street lamp to pStreetLamp, however this object is being destroyed. the tempStreetLamp, which is meant to be destroyed, is not, and instead the permanent street lamp is. What is going on??
okay okay this is really strange. I tried setting tempStreetLamp.SetActive(false) and its turning permanentStreetLamp to false. and So is permanentStreetLamp.SetActive(false). huh???????