// Use this for initialization void Start() { if (useFullScreen) { touchPad = GameObject.Find("Pad").GetComponent <TouchPadBog>(); } else { touchPad = GetComponent <TouchPadBog> (); } rigitBody = GetComponent <Rigidbody> (); }
void OnEnable() { GameObject padObj = GameObject.FindGameObjectWithTag("TouchPad"); if (padObj != null) { pad = padObj.GetComponent <TouchPadBog>(); } if (pad == null) { print("no touch pad define"); } print("enabled"); }