Playmaker Forum
PlayMaker Updates & Downloads => Share New Actions => Topic started by: Andrew.Lukasik on October 17, 2011, 08:40:26 AM
-
RestartLevel.cs
Action to restart current level.
Description: Action restarts current level immediately using one line of code:
Application.LoadLevel(Application.loadedLevelName);
// (c) Copyright HutongGames, LLC 2010-2011. All rights reserved.
// micro script by Andrew Raphael Lukasik
using UnityEngine;
using System.Collections;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Level)]
[Tooltip("Restarts current level.")]
public class RestartLevel : FsmStateAction
{
public override void Reset(){}
public override void OnEnter() {Application.LoadLevel(Application.loadedLevelName); }
}
}
-
Nice one!
-
How can i restart the level, with losing the information and objects i kill?
-
Hi,
i believe local variables are reset but global variables are not
what you can do is @ the start of you game to set your globals or just before the "restart level" action