加载场景不销毁物体
挂在不想销毁的物体上
using UnityEngine; public class DontDestroyObject : MonoBehaviour { private static DontDestroyObject instance; private void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } } }
标签:DontDestroyObject,场景,物体,instance,销毁,加载 From: https://www.cnblogs.com/gatran/p/17844716.html