jkigel
jkigel

Reputation: 1592

Cocos2d - a way to get the current scene?

I'm looking for a way to get the current scene so that I'll be able to tell which scene is running at any time.

Thanks!

Upvotes: 12

Views: 10928

Answers (1)

Sandro Meier
Sandro Meier

Reputation: 3051

Check out CCDirector. You can get the running scene like this:

[[CCDirector sharedDirector] runningScene];

From the documentation of cocos2D:

-(CCScene*) runningScene [read, assign]

The current running Scene. Director can only run one Scene at the time

Sandro Meier

Upvotes: 29

Related Questions