Coroner_Rex
Coroner_Rex

Reputation: 323

Cocossharp CCFadeOut not working

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?

Upvotes: 0

Views: 140

Answers (2)

Ljupcho Hristov
Ljupcho Hristov

Reputation: 275

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

Upvotes: 1

jaybers
jaybers

Reputation: 2211

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.

Upvotes: 1

Related Questions