unity-atoms/Packages/SceneMgmt/Runtime/Actions/ChangeScene.cs
2020-03-09 00:37:52 +01:00

30 lines
709 B
C#

using UnityEngine;
using UnityEngine.SceneManagement;
using UnityAtoms.BaseAtoms;
namespace UnityAtoms.SceneMgmt
{
/// <summary>
/// Action to change scene.
/// </summary>
[EditorIcon("atom-icon-purple")]
[CreateAssetMenu(menuName = "Unity Atoms/Actions/Scene Management/Change Scene")]
public sealed class ChangeScene : AtomAction
{
/// <summary>
/// Scene to change to.
/// </summary>
[SerializeField]
private StringReference _sceneName = null;
/// <summary>
/// Change the scene.
/// </summary>
public override void Do()
{
SceneManager.LoadScene(_sceneName.Value);
}
}
}