- Home /
TOGGLE SCRIPT
HI Everyone, I am trying to enable/disable a script that highlights the cube shown below. I want to do this by pressing a 3D button. The 3D button is a gear that is a child of the cube that is highlighted. The "gear" has a script component which is the "toggle highlight" script. At the moment, when the gear is clicked, the game object just disappears. The images attached show the toggle highlight script and the cube game object. The script I am trying to toggle on/off is attached to the cube itself.
Answer by davejones1 · Jan 27, 2018 at 08:36 PM
a snippet of the togglehighlight script can be useful
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class togglehighlight : $$anonymous$$onoBehaviour { public GameObject box;
void start()
{
}
void On$$anonymous$$ouseDown ()
{
box.SetActive (false);
}
}
script shown below
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class togglehighlight : $$anonymous$$onoBehaviour { public GameObject box;
void start()
{
}
void On$$anonymous$$ouseDown ()
{
box.SetActive (false);
}
}