//Detect if clicks are no longer registering public void OnPointerUp(PointerEventData pointerEventData) { ComponentInteraction placedObjectScript = m_placeObject.GetComponent <ComponentInteraction>(); placedObjectScript.UnselectFromGameController(); m_followPointer = false; }
public void OnChildClick(string childName) { ComponentInteraction activeObject = null; var objects = FindObjectsOfType <ComponentInteraction>(); foreach (ComponentInteraction obj in objects) { if (obj.GetSelected()) { activeObject = obj; } } if (activeObject != null) { activeObject.UpdateButtonPressed(childName); } //GetComponentInParent<ComponentInteraction>().UpdateButtonPressed(childName); }
//Detect current clicks on the GameObject (the one with the script attached) public void OnPointerDown(PointerEventData pointerEventData) { if (!m_controller.IsSimRunning()) { Vector3 spawnPos = transform.position; spawnPos.z = 0; m_placeObject = Instantiate(m_obj, spawnPos, Quaternion.identity); m_followPointer = true; ComponentInteraction placedObjectScript = m_placeObject.GetComponent <ComponentInteraction>(); placedObjectScript.Init(); var components = FindObjectsOfType <ComponentInteraction>(); foreach (var component in components) { if (component.GetSelected()) { component.SetSelected(false); } } placedObjectScript.SelectFromGameController(); } }