- Home /
Question by
dahc2332 · Apr 11, 2012 at 11:12 PM ·
javascriptguicollider
GUI Textures and Colliders
How do I make it so that when I step into a box or a collider that I GUITexture appears?
Comment
Answer by gregzo · Apr 11, 2012 at 11:17 PM
function OnCollisionEnter()
{
myTexture.enabled=true; //if you want it to appear suddenly. Set it to enabled = false in the inspector before...
FadeTexture(myTexture); // If you want a fade
}
function FadeTexture(tex : GUITexture)
{
while(tex.color.a!=targetAlpha)
{
//do your thing here. lerp the texture's alpha, or increase it by a fixed amount every frame, whatever suits your needs...
}
}
Your answer
![](https://koobas.hobune.stream/wayback/20220613070217im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Setting Scroll View Width GUILayout 1 Answer
Can someone help me fix my Javascript for Flickering Light? 6 Answers
Limit on GUI Components? 0 Answers
How To Make Ammo & Realod for Gun & Spark for Gun ? 0 Answers
Move and Repeat Terrain 2 Answers