Search Unity

UIBehaviour and OnRectTransformDimensionsChange

Discussion in 'UGUI & TextMesh Pro' started by JacobFast, Feb 24, 2021.

  1. JacobFast

    JacobFast

    Joined:
    Apr 29, 2014
    Posts:
    47
    Mostly to make this thread appear in google search results

    Spend like 4 hours for this trying understand why OnRectTransformDimensionsChange is not being called.

    So for all who try to do this and it does not work, you should add
    [ExecuteInEditMode]
    to make it work in editor, any tips i found in google does not say this and from my point of view this is something you need in editor and rarely during execution, so my thoughts it should have work in editor out of the box and adding "ExecuteInEditMode" is not obvious.
     
  2. Romaleks360

    Romaleks360

    Joined:
    Sep 9, 2017
    Posts:
    72
    Thank you!