Hi im trying to get the hang of changing bools and ints from other scripts. in my case im just trying to change the selected to either 1 or 0. The grid highlight script is attached to multiple cubes who are the children of a empty game object named "Pad"
using UnityEngine;
using System.Collections;
public class MainGUI : MonoBehaviour {
public GridHighlight script;
// Use this for initialization
void Start ()
{
script = gameObject.GetComponent();
}
// Update is called once per frame
void Update ()
{
}
void OnGUI()
{
if(GUI.Button(new Rect(20, 20, 100, 20), "Cube"))
{
script.selected = 0;
}
if(GUI.Button(new Rect(20, 40, 100, 20), "Turret"))
{
script.selected = 1;
}
}
}
↧