public Sprite[] ButtonSprite; //sprite array of buttons void Awake() { if (Click == null) { DontDestroyOnLoad(gameObject); Click = this; } else if (Click != this) { Destroy(gameObject); } }
public Sprite[] ButtonSprite; //sprite array of buttons void Awake() { if (Click == null) { DontDestroyOnLoad(gameObject); // 切换场景不销毁脚本组件所在对象 Click = this; } else if (Click != this) { Destroy(gameObject); } }