//PLACE ON PLANE public void RegisterModelTouch() { Touch touch = Input.touches[0]; RaycastHit hit; ray = Camera.main.ScreenPointToRay(touch.position); if (Physics.Raycast(ray, out hit)) { //var collectScript = GetComponent<tapToCollect>(); tapScript = hit.collider.gameObject.GetComponent <tapToCollect>(); //var objectsToCollect = hit.collider.gameObject.GetComponent<ObjectsToCollect>(); //var noHit = hit.collider.gameObject.GetComponent<GameObject>(); if (tapScript != null) { Debug.Log("object hit"); //objectsToCollect.ObjectPicked(name); tapScript.registerTouch(); // instanceCounter--; } } }
public void SetCountText() { tapScript = GetComponent <tapToCollect>(); //TotalText.text = "Total " + tapScript.count.ToString(); TotalText.text = "Total: " + totalcount.ToString(); }