- Home /
 
               Question by 
               JoshiiWoshi · May 07, 2020 at 06:22 AM · 
                c#scripting problemgameobjectsetactivepanel  
              
 
              Panel GameObject not activating
I want to enable my panel gameobject when I interact with something but it doesn't get enabled when I tell it to do so. I referenced it in the inspector and the console doesn't show any errors. I'm calling the SetDetailText function in another script. And what's weird is that the text does get updated AFTER I stop the game.
Here is my code:
 public class GameManager : MonoBehaviour
 {
     //Objects
     public GameObject statusPanel;
     public Text statusText;
  
     //Private
     float textCooldownTime;
  
     void Start()
     {
         statusPanel.SetActive(false);
         textCooldownTime = 2.0f;
     }
  
     void Update()
     {
         if (statusPanel.activeSelf)
         {
             textCooldownTime -= Time.deltaTime;
             if (textCooldownTime < 0)
             {
                 statusPanel.SetActive(false);
                 textCooldownTime = 2.0f;
             }
         }
     }
  
     public void SetDetailText(string details)
     {
         statusPanel.SetActive(true);
         statusText.text = details;
     }
 }
 
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
Panel GameObject not activating when called from another script 1 Answer
How to reactivate items ? 4 Answers
Creating a GameObject variable without instantiating it? 1 Answer
Reenabling GameObject with SetActive - NullReferenceException 1 Answer
Activating a prefab in the scene by find it over a tag? 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                