Hello, I am trying to make a gameobject appear when set to active but its really confusing me why it isn’t doing just that.
I have it set to active in the scene and in script set to unactive in the start method. With the script its supposed to tell the game object to reappear but its not. The compiler reaches the Debug.Log (“Wave0TutorialEvent1 Should be visible”); so I don’t understand why it is not appearing.
I would really like for your advise on how I should change this and what is wrong. Thanks in advance.
Here’s the code I’m messing around with.
using UnityEngine;
using System.Collections;
public class Wave0TutorialGUIEnabler : MonoBehaviour
{
private bool wave0TutorialEvent1Status;
private bool wave0TutorialEvent2Status;
private GameObject wave0TutorialEvent1TextBox;
void Start()
{
wave0TutorialEvent1TextBox = GameObject.Find("Wave0TuturialEvent1TextBox");
wave0TutorialEvent1TextBox.SetActive (false); //In scene is active but is set to unactive when game is started.
}
void Update()
{
if (wave0TutorialEvent1Status == true)
{
wave0TutorialEvent1TextBox.SetActive (true);
Debug.Log ("Wave0TutorialEvent1 Should be visible");
Invoke ("WaitForDialogue", 10.0f);
wave0TutorialEvent1TextBox.SetActive (false);
wave0TutorialEvent1Status = false;
}
}
void WaitForDialogue()
{
}
void Wave0TutorialEvent1 (bool status)
{
Debug.Log ("Activating event");
wave0TutorialEvent1Status = status;
}
}