- Home /
 
               Question by 
               NetSuprime · Jul 11, 2017 at 10:45 PM · 
                unity 5scripting problemerrorerror messagefast  
              
 
              error CS0118: `UnityEngine.Object.Destroy(UnityEngine.Object, float)' is a `method' but a `type' was expected problem
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement;
public class GameControl : MonoBehaviour {
 public static GameControl instance;
 public GameObject GameOverText;
 public bool GameOver = false;
 // Use this for initialization
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
       new Destroy(GameObject); 
     }
 }
 // Update is called once per frame
 void Update() {
 }
 public void PlaneDied()
 {
     GameOverText.SetActive (true);
     GameOver = true;
 }
}
               Comment
              
 
               
              Answer by Cornelis-de-Jager · Jul 11, 2017 at 11:04 PM
Change this:
 new Destroy (GameObject);
to this:
 Destroy (this.gameObject);
Your answer
 
 
             Follow this Question
Related Questions
Visual Studio Code doesn't work for with unity 2 Answers
Built project, now scripts are missing. 2 Answers
UniRPG Error cs0121. 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                