Files
Cielonos/Packages/com.opsive.behaviordesigner/Runtime/Tasks/Actions/SceneManagement/DontDestroyOnLoad.cs
2026-05-10 11:47:55 -04:00

31 lines
1.1 KiB
C#

#if GRAPH_DESIGNER
/// ---------------------------------------------
/// Behavior Designer
/// Copyright (c) Opsive. All Rights Reserved.
/// https://www.opsive.com
/// ---------------------------------------------
namespace Opsive.BehaviorDesigner.Runtime.Tasks.Actions.SceneManagementTasks
{
using Opsive.GraphDesigner.Runtime.Variables;
using System.Collections.Generic;
using UnityEngine;
[Opsive.Shared.Utility.Category("Scene Management")]
[Opsive.Shared.Utility.Description("Marks the target GameObject to persist across scenes.")]
public class DontDestroyOnLoad : TargetGameObjectAction
{
[Tooltip("The list of GameObjects to mark as DontDestroyOnLoad.")]
[SerializeField] protected List<SharedVariable<GameObject>> m_GameObjects = new List<SharedVariable<GameObject>>();
/// <summary>
/// Marks the target GameObject as DontDestroyOnLoad.
/// </summary>
/// <returns>The status of the action.</returns>
public override TaskStatus OnUpdate()
{
Object.DontDestroyOnLoad(gameObject);
return TaskStatus.Success;
}
}
}
#endif