Scripting : Disactiving a Game Object issue
I am trying to disactive then show a UI element
void Start()
{
spv1 = gameObject;
//UICanvas.GetComponent<Canvas>().enabled = false;
}
private void OnTriggerEnter(Collider collider)
{
if (collider.gameObject.tag == "Player")
{
spv1.SetActive(false);
SoundManager.playSound("itemPickup_sfx");
}
}
[SerializeField]private GameObject uiObject;
void Start()
{
uiObject.SetActive(false);
Debug.Log("Signal");
}
void Update()
{
if(ItemPickupEvent.spv1.activeSelf)
{
Debug.Log("Done!");
}
else
{
Debug.Log("Oh No!");
uiObject.SetActive(true);
}
}
So the main idea is player to take the item, play a sound and show a 3D model on the screen using 2 different scripts, Firstly it says "Signal" at initiation then it starts flooding "Done!" every frame since the object is actived. After i take the object, it doesn't says "Done!" in console anymore but it also doesn't start to do the stuff in the else condition.
Your answer
Follow this Question
Related Questions
Deactivating/Activating Gameobjects is inconsistent 0 Answers
I have prefabs that should be referencing different GameObjects, but they all refer to the same one. 0 Answers
Check if gameobject set to active regardless of its parents settings? 0 Answers
FindObjectOfType returning null... Everytime. 1 Answer
canvas child of another canvas issue 0 Answers