/// <summary> /// OnMouseDown is called when the user has pressed the mouse button while /// over the GUIElement or Collider. /// </summary> void OnMouseDown() { Instantiate(Unit, spawnPoint.position, new Quaternion(0, 0, 0, 0)); RTSResourceController rc = GameObject.Find("PlayerResources").GetComponent <RTSResourceController>(); }
/// <summary> /// Start is called on the frame when a script is enabled just before /// any of the Update methods is called the first time. /// </summary> void Start() { controller = GetComponent <RTSResourceController>(); controller.OnResourcesAdded.AddListener(CheckTarget); }