// Update is called once per frame void Update() { if (appInfo.GetHead() != null && !transform.IsChildOf(appInfo.GetHead())) { transform.parent = appInfo.GetHead(); transform.GetComponent <RectTransform>().localPosition = canvasPos; transform.GetComponent <RectTransform>().localEulerAngles = canvasRot; } }
// Update is called once per frame void Update() { if (h != null) { Vector3 headToSelf = transform.position - h.position; float angle = Vector3.Angle(headToSelf, transform.forward) % 360; //Debug.Log(angle); SetCollidersEnabled(angle < 90 || angle > 270); } else { appInfo = GameObject.Find("TutoriWidgets").GetComponent <IAppInfo>(); Debug.Log("appinfo = " + appInfo); h = appInfo.GetHead(); } }