Changing the state of a variable

So I need a way to do the following:
When choosing from a dropdown menu ( public enum ) a set of variables will show up.

Example:
Dropdown menu with the following options: Food, Drink, Medicine.
their index being Food = 0, Drink = 1, Medicine = 2.

Based on their index number a variable shall show up in the Inspector.
For Food an integer,
for drink a float
for Medicine a float and a bool.

I tried different methods like custom Inspector/Editor windows, but none have worked so far.
Please help me.

This is definitely how it has to work. Go back and find some other custom editor tutorials to try. Start with one of the Unity ones perhaps, or check if Brackeys has any.

Well I actually started from Brackeys of course, and I checked over 20 other tutorials, but all they explained was custom buttons, sliders and functions calling. That’s why I asked for something more specific

Never mind, I got it on a sketchy website, but seems to work, for anyone else interested here:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;

public class Cube : MonoBehaviour
{
    public int level;
    public float xp;
    public float xpToGet;
    public ToolType ToolType;

    private int damage;

    public void SetLevel(int lvl)
    {
        level = lvl;
    }

    public void GetXP(float xpAmmount)
    {
        xp += xpAmmount;

        if (xp >= ((0.1 * ((level * level)/35)))*(level*level) + (level * -1.2) + 6.4)
        {
            level++;
            xp = 0;
        }
    }


    [CustomEditor(typeof(Cube))]
    public class CubeEditor : Editor
    {
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            Cube cube = (Cube)target;

            if(cube.ToolType == ToolType.Weapon)
            {

                cube.damage = EditorGUILayout.IntField("Damage", cube.damage);

                if(GUILayout.Button("Get xp."))
                {
                    cube.GetXP(cube.xpToGet);
                }


            }
        }
    }


}

[System.Serializable]
public enum ToolType
{
    Weapon,
    StoneTool,
    DirtTool,
    WoodTool,
    IronTool
}

just as a little example. The main part is the logic

if(cube.ToolType == ToolType.Weapon)

so if the selected tool type is Weapon then

cube.damage = EditorGUILayout.IntField("Damage", cube.damage);

then cube ( variable named damage ) will be in EditorGUILayout - then a field type ( int for now) in parantahes (sorry for miss spelling) we put a name “Name”, a coma ’ , ’ and the same variable.

that should do it.