Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class LayoutElementResizer : MonoBehaviour
- {
- public LayoutElement element;
- public SuperTextMesh stm;
- public float padding = 0f;
- public void OnEnable()
- {
- stm.OnRebuildEvent += DoResize;
- }
- public void OnDisable()
- {
- stm.OnRebuildEvent -= DoResize;
- }
- public void DoResize()
- {
- element.preferredHeight = stm.preferredHeight + padding;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment