How to control the exposure of public variables in the inspector pane based on a value of another variable?

Hello,

Let’s say that I have enums.

    public enum StoryUIButton
	{
		Music, 
		SoundEffects, 
		PauseAndResume,
		Continue, 
		Restart,
		MainMenu,
		NextLevel,
	};
	public StoryUIButton ThisStoryButtonIsFor;

Now based upon the value I select for “ThisStoryButtonIsFor” in the inspector, I want to expose a certain set of variables?

 // If is a Music Button, this should be exposed, else hide in the inspector pane
 	public UISprite EnabledSprite, DisabledSprite;
    
 // If it is a PauseAndResume button -> this variable should be exposed, else hide in the inspector pane
  	public Transform MultiplierLabel, ScoreLabel, BaseHUD;
    	
 // If it is a Continue button -> this variable should be exposed, else hide in the inspector pane.
   	public Transform [] HUDWings = new Transform [3];

Is it possible? If so how?

Thank you and your help is always appreciated.

Karsnen

The short answer is that you’re going to want to look at a Editor script, particularly custom editors. You can use an EnumPopup to handle the enum and then draw editor fields based on what is selected. I have an example I can dig up for you, but this should get you started in the right direction.