playMaker

Author Topic: Loading next Scene/Level [Solved]  (Read 2825 times)

jayf

  • Playmaker Newbie
  • *
  • Posts: 40
Loading next Scene/Level [Solved]
« on: May 11, 2014, 04:45:55 PM »
Hi!

I'm about to start designing my games main menu.
So basically lets say I press the Start Mission button at the main menu and would like to load the first level, what Action would I need for that? I'm guessing I'd need to attach my Level 1 Scene file somehow....

Any help is greatly appreciated :).
« Last Edit: May 12, 2014, 11:41:57 AM by jayf »

Lostcity

  • Playmaker Newbie
  • *
  • Posts: 31
Re: Loading next Scene/Level
« Reply #1 on: May 11, 2014, 05:49:51 PM »
I haven't used PlayMaker to load levels yet (I just use a regular script) but I guess it would go something like this:

State 1: Get Mouse Button Down (also works for touch). Transition to state 2

State 2: Action Load Level (from action browser). Type in level name.

-Or-

You can create a new Javascript and copy and paste this into it, then attach it to your GUI Texture:

#pragma strict

function OnMouseDown(){
Application.LoadLevel("WhateverLevelYouWant");
}


Note:

- MouseDown functions will work for both PC and touch devices.
- In order to load a level you must add the scene to the build settings (in order).


jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Loading next Scene/Level
« Reply #2 on: May 11, 2014, 06:29:28 PM »
You don't need to mess around with javascript, just use the playmaker actions;

Make sure you've added all of your levels into the Build Settings window first.

Attach a Load Level action to your FSM on your GUI button, and use the global transition On Mouse Down or On Click or whatever is appropriate to trigger it. You then just list your level to load, matching how it's titled in your project.


jayf

  • Playmaker Newbie
  • *
  • Posts: 40
Re: Loading next Scene/Level
« Reply #3 on: May 12, 2014, 11:40:45 AM »
Awesome both your suggestions work. Thanks a lot for the quick response :).