Question by
Goatcheesecough · Oct 12, 2015 at 05:41 PM ·
script.enabledisable object
Having trouble disabling and enabling game objects
#pragma strict
var Dialouge01 : GameObject;
var Dialouge02 : GameObject;
private var Somethings : boolean;
function OnTriggerEnter (other : Collider)
{
if(other.tag == "Player")
{
Destroy(gameObject);
}
{
Somethings = true;
}
}
if (Somethings == true)
if (Dialouge01.activeInHierarchy == (true))
{
Dialouge01.SetActive(false);
Dialouge02.SetActive(true);
}
I wanted to make it so that when you touch a object the object disappears and it changes Dialouge01 to disabled and Dialouge02 to enabled. I don't get any errors but only the object disappearing part works. By the way the Dialouge1 and Dialouge2 game objects are both generic cubes without mesh renderers.
Thanks ~Jordan
Comment
I just posted a similar question. I can't get it to work with a Canvas either. Still, enabling it manually at runtime by clicking the checkbox on the left side of the title in the inspector works.
Is this the same for you, or doesn't it work for you either? I know this would not be a solution, I am just curious.