public void Raycast(Ray ray, float distance, List <RaycastResult> raycastResults)
        {
            var results = new List <RaycastResult>();

            if (enablePhysicsRaycast)
            {
                PhysicsRaycast(ray, distance, results);
            }
            if (enableGraphicRaycast)
            {
                var tempCanvases = CanvasTargetCollector.GetCanvases();
                for (int i = tempCanvases.Count - 1; i >= 0; --i)
                {
                    var target = tempCanvases[i];
                    if (target == null || !target.enabled)
                    {
                        continue;
                    }
                    GraphicRaycast(target.canvas, target.ignoreReversedGraphics, ray, distance, this, results);
                }
            }
            var comparer = GetRaycasterResultComparer();

            if (comparer != null)
            {
                results.Sort(comparer);
            }
            for (int i = 0, imax = results.Count; i < imax; ++i)
            {
                raycastResults.Add(results[i]);
            }
        }
 protected override void OnDisable()
 {
     Debug.Log("OnDisable");
     base.OnDisable();
     CanvasTargetCollector.RemoveTarget(this);
 }
 protected override void OnEnable()
 {
     Debug.Log("OnEnable");
     base.OnEnable();
     CanvasTargetCollector.AddTarget(this);
 }