Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Getting size or a SerializedProperty's Property Drawer inside another Property Drawer

Discussion in 'Scripting' started by Chris_TerraTech, Oct 2, 2015.

  1. Chris_TerraTech

    Chris_TerraTech

    Joined:
    Sep 16, 2014
    Posts:
    30
    Hi,

    I have a custom inspector for a MonoBehaviour class (Lets call it A).
    Inside this class lives a System.Serializable, non-monobehaviour, class (B), which has a further System.Serializable, non-monobehaviour, class (C).

    Both B and C have Property Drawers.

    C works fine in other classes either via default inspector or via EditorGUILayout.PropertyField() on a class without a custom inspector.

    However when I try to use C inside B I have to know the size C will be to set the rect.

    Is there a way I can do this via code? Somehow using the overridden GetPropertyHeight from the property drawer?
     
  2. Roland1234

    Roland1234

    Joined:
    Nov 21, 2012
    Posts:
    190
    Nefisto and jister like this.
  3. Chris_TerraTech

    Chris_TerraTech

    Joined:
    Sep 16, 2014
    Posts:
    30
    Thanks!
    That's absolutely fantastic :D