public static JoyStickControlor GetInstance() { if (JoyStickControlor.instance == null) { GameObject gameObject = GameObject.FindGameObjectWithTag("UICamera"); if (gameObject != null) { JoyStickControlor.instance = gameObject.GetComponent <JoyStickControlor>(); if (JoyStickControlor.instance == null) { JoyStickControlor.instance = gameObject.AddComponent <JoyStickControlor>(); JoyStickControlor.instance.uicamera = gameObject.GetComponent <Camera>(); } } } return(JoyStickControlor.instance); }
public static JoyStickControlor GetInstance() { if (instance == null) { GameObject cameraObj = GameObject.FindGameObjectWithTag("UICamera"); if (cameraObj != null) { instance = cameraObj.GetComponent <JoyStickControlor>(); if (instance == null) { instance = cameraObj.AddComponent <JoyStickControlor>(); instance.uicamera = cameraObj.GetComponent <Camera>(); } } } return(instance); }