コード例 #1
0
        protected override void OnStyleChanged(UIStyle style)
        {
            base.OnStyleChanged(style);

            if (BackdropImage != null)
            {
                Backdrop.Update(BackdropImage, DefaultBackdrop);
            }
        }
コード例 #2
0
        private void ShowBackdrop()
        {
            var index  = Transform.GetSiblingIndex();
            var parent = new GameObject($"{Name} Backdrop", typeof(Image));

            parent.transform.SetParent(Transform.parent);
            parent.transform.SetSiblingIndex(index);

            _backdropImage = parent.GetComponent <Image>();

            Backdrop.Update(_backdropImage, DefaultBackdrop);

            var layout = parent.GetComponent <RectTransform>();

            layout.anchorMin = Vector2.zero;
            layout.anchorMax = Vector2.one;

            layout.offsetMin = Vector2.zero;
            layout.offsetMax = Vector2.zero;
        }