15
2012
How to make GUITexture to flash white
(Been busy doing a small 3D simulator for iPad3..)
Customer wanted a thunder sound on the main menu (when entering it),
I also added a brigth flash effect for the gui textures (logo, buttons, background).
Flash also needs to happen at a given time (to match the sound).
Version#1
// variables
– take reference to each GUITexture objects, get their textures
– variable for flash texture (could be just white blurred box..)
Awake()
– Disable gui textures (you could disable them in inspector, but then you cannot see them in editor..)
Start()
– invoke(“FlashGUI(),1.5);
FlashGUI()
– Change GUITexture color to Color.white, that makes it brighter
– If changing color doesnt do it, change gui texture to white texture
– invoke(“ShowGUI(),0.2); // we show the white textures for 0.2sec, then go to switch real gui textures
ShowGUI()
– Change GUITexture color to Color(0.5,0.5,0.5,1), that makes it normal color
– If you didnt change color, change gui texture to correct gui texture
//notes
– It might look better with a fast color fade, from bright to normal(?)
– You could also do this in the Update() loop: check in which part of the sound is playing (audiosource.time)
Related Posts
Leave a comment
Recent posts
- MotionVector Effect: Object “disappears” when paused
- [GreaseMonkey] Unity Forum Fixer
- UnityHub: Make Hub application background Translucent
- Customize SpriteShapeRenderer quality (but has issues)
- Editor tool: Copy selected gameobject’s names into clipboard as rows (for Excel)
- Editor tool: Replace string in selected gameobject’s names
- UnityHub: Enable built-in Login Dialog (no more browser login/logout issues!)
- Use TikTok-TTS in Unity (with WebRequest)
- Create Scene Thumbnail Image using OnSceneSaved & OnPreviewGUI
- webgl+javascript TTS
- Using Moonsharp (LUA) + Unity Webgl
- Using 3D gameobject prefabs with Unity Tilemap + NavMesh Surface
Recent Comments
- [Asset Store] Point Cloud Viewer & Tools on
- [Asset Store] Point Cloud Viewer & Tools on
- Vector3 maths for dummies! on
- UnityHub: Make Hub application background Translucent on
- UnityHub: Make Hub application background Translucent on
- Install Android SDK+JDK+NDK for Unity (without AndroidStudio or Unity Hub) on
- Install Android SDK+JDK+NDK for Unity (without AndroidStudio or Unity Hub) on
- [Asset Store] Point Cloud Viewer & Tools on