using UnityEngine; using UnityEngine.UI; namespace SRDebugger.UI.Other { [ExecuteInEditMode] [RequireComponent(typeof(ScrollRect))] public class ScrollRectPatch : MonoBehaviour { public RectTransform Content; public Mask ReplaceMask; public RectTransform Viewport; private void Awake() { ScrollRect component = GetComponent(); component.content = Content; component.viewport = Viewport; if (ReplaceMask != null) { GameObject gameObject = ReplaceMask.gameObject; Object.Destroy(gameObject.GetComponent()); Object.Destroy(gameObject.GetComponent()); Object.Destroy(ReplaceMask); gameObject.AddComponent(); } } } }