- Home /
Missing Reference Exception
I'm trying to instantiate a prefab object that has a Audio Source in, because an error, I deleted the prefab and made it again, but now I have another error that says: "MissingReferenceException: The variable Logro1 of Montañita1 doesn't exist anymore. You probably need to reassign the Logro1 variable of the 'Montañita1' script in the inspector." When I step over the collider it works, I can listen the audio but the error is there, and it creates a clone that even if I put "destroy", it still here. The code is:
 public class Montañita1 : MonoBehaviour
 {
     public GameObject Logro1;
     public Text myText;
 
     void OnTriggerEnter2D (Collider2D other)
     {
         StartCoroutine ("Logro");
     }
 
     IEnumerator Logro ()
    {
        Instantiate(Logro1);
        myText.text = ("Encontraste tu primer fósil! Muy bien!");
        yield return new WaitForSeconds (4);
        Destroy(myText);
        Destroy(gameObject);
    }
 }
Answer by Harry_Drew · Jan 04 at 03:18 PM
I don't think you have assigned the variable of 'Logro1' in the inspector
Your answer
 
 
             Follow this Question
Related Questions
error CS0161: not all code paths return a value 2 Answers
Polygon Collider 2D Fatal Error 0 Answers
Help with IEnumerator and if sound is playing 2 Answers
PlayClipAtPoint Qualify with Type Name 2 Answers
Narf question on scope - I think :/ 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                