Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    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