I’m trying to create an intro that goes in the start menu screen. I’m trying to create something that’s similar to Zelda: Twilight Princess intro. I’ve animated the cameras but I couldn’t figure out how to fade in the title screen. Is it possible to fade in or out a gui texture? Something that changes the opacity in a specific time. Hope someone can help.
You can make a GUITexture fade in by varying the alpha value of its color property. A neat way to do this is to start a coroutine at the point when you want the fading to begin:-
function FadeTex(fadeTime: float) {
var startTime = Time.time;
while ((Time.time - startTime) < fadeTime) {
guiTexture.color.a = (Time.time - startTime) / fadeTime;
yield;
}
}
Hi Andee,
Thanks for the reply. I’m actually testing a scene right now. I’m using a script available at unitywiki called Fade. Then I just made a simple timer to call certain GUI textures. Very awesome indeed
As for coroutines, I still can’t understand them or know exactly when to use them
I just realised I’ve made things complicated. At the moment I have a number of GUITexture on the screen each with a fade script attached. The scripts are basically timers that activate the fade after a certain time. So I have one activated after 13 seconds, 14 seconds etc. Only after maximising the scene during gameplay that I realised that the positions of the textures are not in the middle
I know I need to code to put them in the middle. That’s fine since I think I’m ok with OnGUI stuff. The problem I have right now is how to fade each of the guitexture. Should I have one js file to manage the drawing of the gui texture or should I have them each separated since most of the fade code’s sample is attach to one gameobject(guitext/guitexture).
I think I know how to do them but I’d like to have a second opinion on how to approach this.