|
Hi, I'm a script in JS and I want to get the reference to my own gameobject so that i can do this: abc = gameObject.AddComponent("AbcScript"); Is it possible? Thanks!
(comments are locked)
|
|
If the script you are using is on the object you want to destroy, you can use Destroy(gameObject); It will destroy itself.
(comments are locked)
|
|
That's correct: gameObject alone is a reference to the object to which the script is attached, thus you will add AbcScript to it and get a reference to the script in abc. The same applies to transform, renderer, collider etc. Ah so that's the difference between gameObject and GameObject! I always think that gameObject was a typo for GameObject class lol. Thanks guys, 2 questions in 1! ;)
Aug 19 '12 at 07:59 PM
NeMewSys
(comments are locked)
|
