0

I use cocossharp. I want to add fade in/out transition when replacing scene. The fade in for the second scene works fine, but the current scene's fade out is not working.

My code for transition at GameStartScene.cs is:

gameStartLayer.RunAction (new CCFadeOut (1.5f));
GameAppDelegate.GoToGameScene (); //director.ReplaceScene (new CCTransitionFade(1.5f, gamePlayScene));

How can I implement a fade out effect for the scene?

Coroner_Rex
  • 323
  • 4
  • 17

2 Answers2

1

The GoToGameScene runs immediately after the RunAction above. Are you trying to wait until the RunAction completes before going to the game scene?

If so, make a sequence with your CCFadeOut followed by a CCDelayTime(1.5f) then run that sequence. The other option would be a wrapping your Goto game scene in a CCCallFunc.

jaybers
  • 1,991
  • 13
  • 18
1

jaybers is right about: "The GoToGameScene runs immediately after the RunAction above" BUT! you should do this:

 await gameStartLayer.RunActionAsync(new CCFadeOut (1.5f));
 GameAppDelegate.GoToGameScene(); 

If you want to wait until going to next scene

Ljupcho Hristov
  • 255
  • 3
  • 5