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

I want to change the transparency or visibility (alpha) with a UI button

$
0
0
Hi, I am trying to enable an UI Button, but I cant....I want to enable my script with the function (On Click) adding the Update function. But it doesn't work. Basically I want to change the transparency or visibility (alpha) with this button Please any advice is more than welcome. private var a : float = 1; // alpha starts at 1 var fadeSpeed : float = 2; private var Green : b!oolean = true; function Update(){ if(Green == true){ GetComponent.().material.color.a = Mathf.Lerp(GetComponent.().material.color.a, 1, Time.deltaTime * fadeSpeed); }else{ GetComponent.().material.color.a = Mathf.Lerp(GetComponent.().material.color.a, 0, Time.deltaTime * fadeSpeed); } }![alt text][1] [1]: /storage/temp/56618-capture.jpg

Viewing all articles
Browse latest Browse all 1875

Trending Articles



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