2D Toolkit Forum

2D Toolkit => Support => Topic started by: Hamlet Archer on November 04, 2012, 02:21:05 am

Title: iTween Camera Fade
Post by: Hamlet Archer on November 04, 2012, 02:21:05 am
Hello! I cannot get the tk2dCamera to work with the iTween.CameraFade. I use the following code to fade in the whole scene:

Code: [Select]
iTween.CameraFadeAdd(cameraTexture, 100);
iTween.CameraFadeFrom(1, 1);

The fade works on the default Unity camera, but not on the tk2dCamera. Is there a way to get 2D Toolkit to work with iTween? Or might there be a convenient way to fade in/out stuff without having to setup my own custom overlays? Thanks!  ;D
Title: Re: iTween Camera Fade
Post by: Hamlet Archer on November 04, 2012, 10:32:21 am
looking through the itween code, i think i have found the answer to my own question:

the iTween.CameraFadeAdd creates a GUITexture as overlay, which is not rendered in the default tk2dCamera because it doesn't have a GUILayer component. it works once i have added that... just in case anyone else runs into the same problem.  :P
Title: Re: iTween Camera Fade
Post by: unikronsoftware on November 04, 2012, 03:01:56 pm
Hi Hamlet, you can create a full screen black sprite (just a tiny sprite scaled up loads).
You can then fade that in/out manipulating the .color.a - this way you don't have to add an additional camera.
Title: Re: iTween Camera Fade
Post by: Hamlet Archer on November 05, 2012, 12:14:13 am
Thanks! I agree it's better to not add a camera just for that fade effect. I just didn't understand why it wasn't working before... Thanks for responding though.  ;)