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!
3 Answers
3
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.
I fixed this by changing the GameObject to gameObject, but thanks anyways!
function OnTriggerEnter()
{
Destroy(gameObject);
}
I solved this issue by changing the GameObject to gameObject.
But thank you anyways!
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.
– Graham-Dunnett