|
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:
(comments are locked)
|
|
@Confused You dont need to say just 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 In Update.. 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 THANK YOU. works like a charm. also thanks for the tips on simplifying the script and getting rid of unnecessary text.
May 06 '12 at 01:45 AM
Confused
(comments are locked)
|
