playMaker

Author Topic: Get Level Num?  (Read 2457 times)

_adamturnbull

  • Playmaker Newbie
  • *
  • Posts: 18
Get Level Num?
« on: May 09, 2014, 10:51:37 AM »
Hi,

Is there a way to get the level number and store it as a variable. I know you can load level by number but I haven't found a way to get the level number.

Cheers,
Adam

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Get Level Num?
« Reply #1 on: May 09, 2014, 10:55:06 AM »
There's an action called "Level Name to String" which will save the scene name. I think it was a custom action that I found on the forum - either in the Share New Actions or Action Requests.

_adamturnbull

  • Playmaker Newbie
  • *
  • Posts: 18
Re: Get Level Num?
« Reply #2 on: May 09, 2014, 01:17:53 PM »
Thanks, I have that. I was looking to get the level number rather than the name if possible :)

Cheers,
Adam

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Get Level Num?
« Reply #3 on: May 09, 2014, 01:43:23 PM »
How do you have your levels named/numbered?

Is it 'one scene is one level'?

You could always then use the level name string and then use 'Get String Right' and get the digits that you want from the end of the scene name and save that as an int.

Isn't Load Level Number dependant on the order of scenes that you have in your build settings? It'd probably be more efficent/safe to use Load Level and use a variable, just incase anything changes, then it won't break.

_adamturnbull

  • Playmaker Newbie
  • *
  • Posts: 18
Re: Get Level Num?
« Reply #4 on: May 09, 2014, 01:54:08 PM »
Ok cheers, Jess! I might just go with that technique instead :)