Hi, i am still learning scripting so help would be appreciated.
What i am trying to achieve is:
-when scene starts aaa object is deactivated and bbb activated -THIS WORKS
-when button is pressed i want aaa object activated and bbb deactivated - THIS STILL WORKS
-when button is pressed again i want aaa deactivated again and bbb activated again - player could switch between these infinitely - But that part doesn’t work and Unity doesn’t give me any errors.
I work with Unityscript.
#pragma strict
var aaa : GameObject;
var bbb : GameObject;
function Start()
{
aaa.SetActive(false);
}
function Update ()
{
if(Input.GetMouseButtonDown(2)) {
bbb.SetActive (false);
aaa.SetActive (true);
}
if(Input.GetMouseButtonDown(2) && bbb.SetActive == false && aaa.SetActive == true) {
bbb.SetActive (true);
aaa.SetActive (false);
}
}