Dinamically displaying fields on inspector

I have a script that uses an enum to display a dropdown menu, but now i need to display a Vector2 field in the inspector depending on which enum is selected.

My class properties look like that:

public class EnemyFly : MonoBehaviour {

public WaveType waveType;  
public Vector2[] locations;  

}

And, in an external script:

public enum WaveType {

Deffault,
SmoothStep, 
SmootherStep, 
EaseIn, 
EaseOut,
Estationary,
Pulse

};

I found a solution that worked for me.
First of all, i had to remove [HideInInspector] flag, that was the main problem.
Then, i move WaveType to my script, i really didn’t need it anything else.

My final code looks like:

public override void OnInspectorGUI(){
    		serializedObject.Update ();
    
    		EnemyFly.WaveType wt =  EnemyFly.WaveType)waveType_prop.enumValueIndex;
    
    		if (wt == EnemyFly.WaveType.Estationary)
    			EditorGUILayout.PropertyField (locations_prop, new GUIContent ("Locations"), true);
    
    		serializedObject.ApplyModifiedProperties ();
}

The “bad” thing, is that with this solution i have to write code for any property, but that is not a real problem in my case, bc it’s a very wide a script very customizable