How to manually create property fields of a class

Hey all, here is my problem.

I have a class that I want to reference another base class say Class2 from which other classes will inherit. However I want to be able to dynamically add it to inspector without it being a MonoBehavior added to a GameObject. I want to take it from the project pane and assign it there.


If this isn’t possible can I simply show the properties of a Type Class2? I could then save them to a text file and load them manually, while instantiating the class in game.

Thanks for reading.

I suspect you want your Class2 to be a ScriptableObject Unity - Scripting API: ScriptableObject

Let’ consider you have

[System.Serializable]
public class NonMono:ParentNonMono
{
   [SerializeField]
   private bool dataBool;
   [SerializeField]
   private string dataString;
}

then you can use:

public class Test:MonoBehaviour{
   [SerializeField]
   NonMono nonMono = null;

   void Start(){
      nonMono = new NonMono(); 
   }
}

This will show the member of nonData.

This is for the second case if you don’t want to use ScriptableObject