GUI fade with iTween

I do not understand why the button is not part of the camera fade … And, besides, I need to know how to fade only the GUI.

My code:

// Variáveis
var altura;
var largura;
var Botao_Modificado : GUIStyle;
var Cor = Color.black;
Cor.a = 0;

function OnGUI()
{
    GUI.Button(Rect(largura, altura, 200, 100), "Teste de Botão2!", Botao_Modificado);
}

function Start()
{
    altura = Screen.height - 400;
    largura = Screen.width - 380;
    iTween.CameraFadeAdd();
    iTween.CameraFadeTo(1, 4.0);
    yield WaitForSeconds (4);
    iTween.CameraFadeTo(0, 4.0);
    iTween.ColorTo(gameObject, Cor, 4.0);
}

function Update()
{
    
}

Sorry, one of the issues with the CameraFade in iTween is that it won’t appear above UnityGUI. There’s no way around it. I would just try to make sure you remove your GUI before you fade.

Ok… Thanks, pixelplacement1… I have another idea …

If I put a GUI on a higher plane, with a totally dark texture covering the whole screen … so when necessary to make the fade, the only thing that I need to do is change the Alpha of the texture, leaving nothing else visible.

How can I code this? :?

@pixelplacement1 - I’m trying to use the GUI Texture with the “FadeTo” propert. It works, but not the way I thought it would. I need it to loop. I tried what I thought would work. I kept getting the error FadeTo only takes 4 arguments. Can you help? Here’s what the code looks like

using UnityEngine;
using System.Collections;


public class guiFader : MonoBehaviour
	
{	
	public GameObject target;
		
	void Update(){
		
		iTween.FadeTo(target, 0.0f, 0.5f);

	}
}