using UnityEngine; namespace Ashwild.Core { /// /// Drop-in component that makes its GameObject survive scene loads. Add it in the editor to any /// object that must persist — including third-party prefabs you'd rather not edit (the FishNet /// NetworkManager, the Steam manager) — and in Awake it detaches to the scene root and marks /// itself persistent (via ). /// /// It only handles persistence: duplicate handling stays the job of the object's own singleton /// (its guard destroys the extra copy when a scene reloads). Runs very early so the object is /// already a persistent root before the other components' Awake. /// [DefaultExecutionOrder(-10000)] [DisallowMultipleComponent] public class PersistentObject : MonoBehaviour { /// /// Detaches to the root and persists across scene loads. /// private void Awake() => Persistence.Persist(gameObject); } }