private void OnDestroy() { _textureAtlas?.Destroy(); _textureAtlas = null; if (_instance == this) { _instance = null; } }
private void Awake() { // 只允许有一个对象 if (_instance != null && _instance != this) { Debug.LogWarning("TextureAtlasManager已存在,请勿重复创建!"); Destroy(this); return; } _instance = this; }