void Start() { TouchRayEvent.GetInstance().AddListen(target.gameObject, true, false, false); CanvasScaler canvasScaler = GameObject.FindObjectOfType <CanvasScaler> (); ratio = canvasScaler.referenceResolution.y / (float)Screen.height; if (!target) { target = transform; } if (!parent) { parent = new GameObject("parent").transform; parent.SetParent(target.parent); parent.localPosition = Vector3.zero; parent.localEulerAngles = Vector3.zero; parent.localScale = Vector3.one; target.SetParent(parent); } }
void OnDestory() { TouchRayEvent.GetInstance().RemoveListen(target.gameObject); }