Hello Guest

Author Topic: iTween Camera Fade  (Read 8476 times)

Hamlet Archer

  • Newbie
  • *
  • Posts: 4
    • View Profile
iTween Camera Fade
« 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

Hamlet Archer

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: iTween Camera Fade
« Reply #1 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

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: iTween Camera Fade
« Reply #2 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.

Hamlet Archer

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: iTween Camera Fade
« Reply #3 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.  ;)