How do I show a prefab's public variables in a custom editor when I add it to a gameobject list?
So, I'm trying to create this custom editor for a Tower Defense game and I wanted a custom editor to make it easier to create multiple waves and subwaves of enemies.
When I click the "New Enemy" button, it adds an element to my list of gameobjects, which is the list of enemies that need to come in the next wave:

What I can't get my head around is how to show the gameobject's public variables whenever I add the gameobject prefab to the list. These are the public variables:
 public class Enemy : MonoBehaviour
 {
     public int health;
     public int defense;
     //I don't want to show the health and defense in the editor
     public int number; //Number of enemies to spawn
     public float pace; //The pace in which they spawn
     public float cooldown; //How many seconds will pass before they start to spawn
     public GameObject spawn; //Where the enemy is born
     public GameObject goal; //Where the enemy is headed to
 }
 
               There is more stuff that I want to add to the enemy like public functions, but this is enough for now.
So, what I wish was happening:
Click button to add gameobject field; //working
Drag enemy1 (prefab) to the field; //working
The prefab's public variables appear right beneath it to edit;
I've tried fiddling with EditorGUILayout.PropertyField but had no luck, at least I didn't understand how to do it.
My code for the button:
 [CustomEditor(typeof(WaveControl))]
 public class TDEditor : Editor
 {
     public override void OnInspectorGUI()
     {
         base.OnInspectorGUI();
 
         WaveControl waveControl = (WaveControl)target;   
 
         if (GUILayout.Button("New Enemy"))
         {
             waveControl.Enemies.Add(waveControl.Enemy);
         }
     }
 }
 
              Your answer