My script lets me take over another object(possessable) by destroying the first person prefab (spirit) and switching the new object's controls on. I can "unpossess" an object by instantiating a prefab of the spirit and disabling the possessed object. This is repeatable.
BUT, after the first time the "spirit" is destroyed, and I possess then possess and unpossess the object again, there are clones of the "spirit" running around. Despite being tagged as spirit, they will not be destroyed.
This code is attached to the possessable objects:
asked May 06 '12 at 12:07 AM
@Confused You dont need to say
for a false boolean statement you would say
So what you want to do is pick up 1 spirit and destroy all of them once one has been picked up? Thats how the current script reads. If you want to destroy the same one you pickup, i would rephrase the code as such
But this method turns the trigger function into an update-type function. So your current method is more efficient, just add another var for your collision "spirit" object
Q/"//Spirit Gameobject is tagged as "Spirit" (as well as children?)" /A/ No dont tag the children.
NOTE If you need a way to keep track of lots of these spirit object and be able to tell them apart, consider creating an ID script and adding it to the prefab and increasing the ID number as you instantiate them(or set them in the inspector as 0,1,2,3,4...)
Thats it. Then you can say something like