Unload Profile#
Save & Load / Unload Profile
Description#
Unloads the current save and returns to the default values
Parameters#
| Name | Description |
|---|---|
| Scene | The scene to load when resetting the save |
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Title("Unload Profile")]
[Image(typeof(IconDiskSolid), ColorTheme.Type.TextLight, typeof(BadgeCross))]
[Description("Unloads the current save and returns to the default values")]
[Category("Save & Load/Unload Profile")]
[Parameter("Scene", "The scene to load when resetting the save")]
[Keywords("Reset", "Restart", "Main", "Menu")]
[Serializable]
public class InstructionCoreLoadUnload : Instruction
{
[SerializeField] private GetScene m_Scene = new GetScene();
protected override string GetTitle(GameObject source) => $"Unload to {this.m_Scene}";
protected override async Awaitable Run(Args args)
{
int sceneIndex = this.m_Scene.Get(args);
await SaveLoadManager.Unload(sceneIndex);
}
}
}