iTween on GUI

I am trying to fade out a GUI area with iTween. I purchased an animation example from the iTween site so that I could see how to invoke an animation / fade, etc … but I can’t seem to put it together for a fade :evil:

Here is my fade function:

function fadeOut_Details()
{     iTween.FadeUpdate(gameObject,iTween.Hash("alpha",0,"time",2));
}

… and this function is called from an OnGUI call (not visible here) and I currently hide / show the GUI contents of this function with a boolean flag (also in non-visible OnGUI). However, I want to fade it out rather than a simple “snap hide”.

function displayLessonDetailsWindow()
{    
 // Background Overlay
 if(GUI.Button(Rect(0,0,500,500),"Click to Fade Out",Background_win))
 {
   // Click big BG button to fade out self and area below.        
   fadeOut_Details();
 }
    
     GUILayout.BeginArea(Rect (0,0,500,500));
       // GUI Stuff in here ... 
    GUILayout.EndArea();
}

I’ve been all over Google for answers and I’m not really finding anything substantial … any help would be greatly appreciated!

(Please don’t point me to the iTween docs… I’ve been there many times)

Thanks!

gui stuff will not fade only 3D things.

to have fading on the gui you need to modify GUI.color before drawing

Pretty certain you can’t fade out UnityGUI elements with iTween as the “GUI” itself isn’t really a gameobject that you can address in that manner. I may be mistaken…

For modifying the GUI.color, will that work for graphics as well, or just solid colors? Currently, I have about 20 individual GUIStyles.

(I have plans to merge them into a GUISkin later).

That was my thought initially, but I was proven wrong by the example I purchased from iTween. It referenced an OnGUI area and animated it by simply using the term “gameObject” … I was hoping it would work the same for alpha.

sure it was an ongui area (unity 2.x UI), not guitexture and guitext (Unity 1.x UI), which indeed are bound to game objects and transform?

Positive. I’d post the code of the functioning animation, but it’s all broken out into functions and it’s hard to trace back to the actual OnGUI function … ironically, for easier reading :slight_smile: