iTween CameraFade not working in some cases (related to camera's cullingMask)

Hello,

I'm at a loss here...

What I'm trying to do

Animate the fading from one camera to another (in the same scene), with iTween (v2.0.43) and Unity Pro 3.3.

How I'm doing it

  1. I create a Texture2D, which contains the current view snapshot.
  2. I assign it to iTween using iTween.CameraFadeAdd( tex_fadeFrom ).
  3. I change the active camera to the new one I wish to use.
  4. I start the tween.

Code is here (I'm not writing the code I use to take a Texture2D snapshot of the view, because the problem is not there: it's working perfectly):

// Here I store the current camera snapshot.
// tex_fadeFrom is a private property.
// HVCameraUtils.getViewScreenshot is the method
// that creates the Texture2D from the current view.
tex_fadeFrom = HVCameraUtils.GetViewScreenshot();
// This calls a setter which changes
// the main camera to the one I wish to fade to.
Vars.activeCam = Vars.isolationCam;
// iTween.
iTween.CameraFadeAdd( tex_fadeFrom );
Hashtable tw = new Hashtable();
tw.Add( "amount", 1 );
tw.Add( "time", 0.7f );
tw.Add( "oncomplete", "Isolate_fadeComplete" );
tw.Add( "oncompletetarget", this.gameObject );
iTween.CameraFadeFrom( tw );

The problem

All works perfectly, until I change the culling mask (via the camera's Inspector) of the secondary camera (isolationCam).

If the culling mask contains some of Unity's default layers, the animation plays correctly. Otherwise (like in this case, in which the culling mask is set to layer 30 alone), the cameras switch correctly, but the fade animation doesn't play (tex_fadeFrom never appears and fades out: simply put, the secondary camera appears immediately). Or better: I can see the animation in the scene view (!), where tex_fadeFrom appears and fades out, but not in the game view.

Please help! :P

I know this is a pretty old question, but I just ran into this problem and resolved it. Basically when iTween creates its camera Fade Texture, it puts it on the “Default” layer. So if your Camera is culling out “Default” you won’t see the fade. You can see this pausing your game while it is running in the editor and look for the iTween Camera Fade Object.

Unfortunately, it doesn’t seem as though Mr. Berkebile programmed a way to easily change the Layer of the texture (just the depth). As such there isn’t an easy way to get a reference to the object and change it’s layer. I just added Default to the masks on my cameras as I don’t really have anything important sitting in that layer anyway. I would imagine you could also search for the object’s name: “iTween Camera Fade” and get a reference that way.

Update
After realizing I do indeed have objects on my default layer, I went back and coded it as described above. Here’s the code solution as I have it:

private void Awake() {
  iTween.CameraFadeAdd (LoadingTexture, 5000);
  findAndChangeCameraFadeObjectLayer();
}

private void findAndChangeCameraFadeObjectLayer() {
	GameObject cameraFadeObject = GameObject.Find ("iTween Camera Fade");
	if(cameraFadeObject)
		cameraFadeObject.layer = 16;
}

because the Texture2D u Get ,base on that culling mask.when your culling mask is set to layer 30 alone. Texture2D is nothing, so .you can’t see anything~~

I have a similar problem where iTween.CameraFadeTo works for a while then it stops fading for no apparent reason, this happened twice on two different projects when all of a sudden fading stop occurring.

My code is very simple, no culling masks involved.

        // First I setup the fade

	void Start () {
        iTween.CameraFadeAdd(fadingScreen, 99999);
	}

    // Then I do the fade (in a different method)
    iTween.CameraFadeTo(iTween.Hash...));

It works for a while then out of the blue kaboom!

After looking at the “iTween Camera Fade” I noticed that when the fade works the GUITexture contains the fadingScreen. In the case when it’s not working the GUITexture is empty.

Why would the “iTween Camera Fade” loose the fadingScreen I setup or even the default one without any reason? Could it be a bug?

Any help is much appreciated.
Paul