Delete Profile#
Save & Load / Delete Profile
Description#
Deletes the game data at a specific profile slot.
Note
If the deleted profile is the one currently loaded, it is also unloaded and the given scene is loaded
Parameters#
| Name | Description |
|---|---|
| Profile | The profile slot to delete |
| Scene | The scene to load if the deleted profile is the one currently loaded |
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Title("Delete Profile")]
[Image(typeof(IconDiskSolid), ColorTheme.Type.TextLight, typeof(BadgeCross))]
[Description("Deletes the game data at a specific profile slot.")]
[Category("Save & Load/Delete Profile")]
[Parameter("Profile", "The profile slot to delete")]
[Parameter("Scene", "The scene to load if the deleted profile is the one currently loaded")]
[Note("If the deleted profile is the one currently loaded, it is also unloaded and the given scene is loaded")]
[Serializable]
public class InstructionCoreDeleteProfile : Instruction
{
[SerializeField] private GetInteger m_Profile = new GetInteger();
[SerializeField] private GetScene m_Scene = new GetScene();
protected override string GetTitle(GameObject source) => $"Delete {this.m_Profile}";
protected override async Awaitable Run(Args args)
{
int profile = this.m_Profile.GetInt(args);
int sceneIndex = this.m_Scene.Get(args);
await SaveLoadManager.Delete(profile, sceneIndex);
}
}
}