- Home /
 
No appropriate version of Destroy
Here's the code:
 function OnTriggerEnter()
 {
     Destroy(GameObject);
 }
 
               And I get: Assets/Standard Assets/Scripts/PlayerDeath.js(3,8): BCE0023: No appropriate version of 'UnityEngine.Object.Destroy' for the argument list '(System.Type)' was found.
Please help me!
I formatted your question for you. Please take the time to learn how to do that. See the video tutorial linked from the side bar.
Answer by eskontie · May 25, 2013 at 01:58 PM
I fixed this by changing the GameObject to gameObject, but thanks anyways!
 function OnTriggerEnter()
 {
 Destroy(gameObject);
 }
 
              Answer by Graham-Dunnett · May 25, 2013 at 12:06 PM
So, GameObject is the name of a type, not the name of a variable. What's the name of the game object you are trying to destroy? Use that in the argument to Destroy. 
The game object is First Person Controller or First Person Controller's camera. So, how I get that in the code?
Answer by eskontie · May 25, 2013 at 12:52 PM
I solved this issue by changing the GameObject to gameObject. But thank you anyways!
Your answer
 
             Follow this Question
Related Questions
Populate game objects from a list?? (C#) 1 Answer
C# Script is affecting multiple GameObjects but I would like it to only affect one of them... 1 Answer
melee system script problem, what did i do wrong or what to do next? 0 Answers
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
unknown identifer explosion problem 2 Answers