Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

Hide GameObject and children

$
0
0
Hi ! I can't fix the different issues i encounter when i try to hide a GameObject... I can't use the SetActive function because of the situation. Can someone help me using the renderer.enabled method ? Here is my JS: #pragma strict var primary : GameObject; var kobra : GameObject; function Start () { kobra = GameObject.Find("KobraSight"); } function Update () { if(Input.GetButton("Fire2") && primary.activeSelf){ kobra.GetComponent(Image).enabled = true; // Hide renderers of "primary" GameObject //... // } } if( ! (Input.GetButton("Fire2") && primary.activeSelf)){ kobra.GetComponent(Image).enabled = false; // Show renderers of "primary" GameObject //... // } } Thank you in advance !

Viewing all articles
Browse latest Browse all 1875

Trending Articles



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