Unity构造单例模式 Posted on 2019-04-09 | | Visitors: public class GameManager : MonoBehaviour{ public static GameManager instance; private void Awake() { //singleton pattern if (!instance) { instance = this; } else if (instance != this) { DestroyImmediate(this); } }}