Quantcast
Channel: Questions in topic: "clone"
Viewing all articles
Browse latest Browse all 508

How do I not deactivate all clone's inputfields?

$
0
0
I attach the below scrip to my instantiated prefab (GameObject + myinputfield (child)). When I try to click on one of the instantiated prefab GameObject, myinputfield is deactivated correctly but this happens in all my clones. How can I deactivate just the input field of the GameObject I've hit with the Ray? Thank you! using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class ClickToSee : MonoBehaviour { [SerializeField] public LayerMask gameobjectslayer; public GameObject myinputfield; void Update(){ if (Input.GetMouseButtonDown (0)) { RaycastHit rayHit; //we shoot ray and hits //if the ray hits the gameobjects layer... if (Physics.Raycast (Camera.main.ScreenPointToRay (Input.mousePosition), out rayHit, Mathf.Infinity, newcubeslayer)) { myinputfield.SetActive (false);

Viewing all articles
Browse latest Browse all 508

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>