public static void Initialize(TrueShadow shadow, ref ShadowRenderer renderer)
        {
            if (renderer && renderer.shadow == shadow)
            {
                renderer.gameObject.SetActive(true);
                return;
            }

            var obj = new GameObject($"{shadow.gameObject.name}'s Shadow")
            {
#if LETAI_TRUESHADOW_DEBUG
                hideFlags = DebugSettings.Instance.showObjects
                            ? HideFlags.DontSave
                            : HideFlags.HideAndDontSave
#else
                hideFlags = HideFlags.HideAndDontSave
#endif
            };

#if LETAI_TRUESHADOW_DEBUG && UNITY_EDITOR
            UnityEditor.SceneVisibilityManager.instance.DisablePicking(obj, true);
#endif

            shadow.SetHierachyDirty();

            var rt = obj.AddComponent <RectTransform>();
            rt.anchorMin = Vector2.zero;
            rt.anchorMax = Vector2.zero;

            var graphic = obj.AddComponent <RawImage>();
            graphic.raycastTarget = false;
            graphic.color         = shadow.Color;

            renderer         = obj.AddComponent <ShadowRenderer>();
            renderer.shadow  = shadow;
            renderer.rt      = rt;
            renderer.graphic = graphic;

            // renderer.RecreateGraphic(shadow.Baked ? GraphicType.Image : GraphicType.RawImage);

            renderer.UpdateMaterial();

            renderer.CanvasRenderer = obj.GetComponent <CanvasRenderer>();
            renderer.CanvasRenderer.SetColor(shadow.IgnoreCasterColor ? Color.white : shadow.CanvasRenderer.GetColor());
            renderer.CanvasRenderer.SetAlpha(shadow.CanvasRenderer.GetAlpha());

            renderer.ReLayout();
        }
        public static void Initialize(TrueShadow shadow, ref ShadowRenderer renderer)
        {
            if (renderer && renderer.shadow == shadow)
            {
                renderer.gameObject.SetActive(true);
                return;
            }

            var obj = new GameObject($"{shadow.gameObject.name}'s Shadow")
            {
#if LETAI_TRUESHADOW_DEBUG
                hideFlags = DebugSettings.Instance.showObjects
                            ? HideFlags.DontSave
                            : HideFlags.HideAndDontSave
#else
                hideFlags = HideFlags.HideAndDontSave
#endif
            };

            shadow.SetHierachyDirty();

            var rt = obj.AddComponent <RectTransform>();

            rt.anchorMin = Vector2.zero;
            rt.anchorMax = Vector2.zero;

            Graphic graphic;
            var     type = shadow.Baked ? GraphicType.Image : GraphicType.RawImage;

            switch (type)
            {
            case GraphicType.Image:
                var image = obj.AddComponent <Image>();
                image.useSpriteMesh = true;

                graphic = image;
                break;

            case GraphicType.RawImage:
                graphic = obj.AddComponent <RawImage>();
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }

            graphic.raycastTarget = false;
            graphic.color         = shadow.Color;

            renderer         = obj.AddComponent <ShadowRenderer>();
            renderer.shadow  = shadow;
            renderer.rt      = rt;
            renderer.graphic = graphic;

            // renderer.RecreateGraphic(shadow.Baked ? GraphicType.Image : GraphicType.RawImage);

            renderer.UpdateMaterial();

            renderer.CanvasRenderer = obj.GetComponent <CanvasRenderer>();
            renderer.CanvasRenderer.SetColor(shadow.IgnoreCasterColor ? Color.white : shadow.CanvasRenderer.GetColor());
            renderer.CanvasRenderer.SetAlpha(shadow.CanvasRenderer.GetAlpha());

            renderer.ReLayout();
        }