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.

Drawing non-object, System.Serializable class in an Editor Window

Discussion in 'Immediate Mode GUI (IMGUI)' started by arvzg, Sep 6, 2021.

  1. arvzg

    arvzg

    Joined:
    Jun 28, 2009
    Posts:
    617
    I have a class that has the System.Serializable attribute, but doesn't derive from Object, so I cannot use
    Editor.CreateEditor(..)
    I want to create an Editor Window that can inspect all the fields of this class.

    If I put this class inside a MonoBehaviour and mark it public or [SerializeField], the class can be inspected in the inspector through that MonoBehaviour - I'm trying to achieve the same thing - but in an Editor Window instead. I'm guessing Unity's default MonoBehaviour inspector code goes through a serializable class field-by-field through reflection? Is there any way I can leverege this code in my Editor Window?