Creating Dropdown menue for variables in the Inspector using C#

Hi , I am trying to get create a dropdown menue for my variables to get something like

Hero stats:-hp

Gear stats:-weapon damage
-dmg reduction

The thing is that I already have a tons of variable to play with but I need to add at least 300 more as I am making a reference script that contains all the variables for my hero. So I need to make some order in there .

Ive read about the possibility of creating a dropdown as the clickable arrows in the inspector (we see it in many scrips that comes with unity) and that is what I look for.

After many tryes I still cant get this to work and everytime I read a post they aren’t using the same procedure at all. This get verry confusing.

Here is the script I have so far , it displays a couple variables and they are divided in the class I would like.

using UnityEngine;
using System.Collections;
public class Test : MonoBehaviour

	//All the booleans that declare a state like : hero is fighting
	public bool isFighting = false;
	public bool isInAction = false;
	public bool isTakingDamage = false;
	public bool isDead = false;
	public bool isLevelingUp = false;
	public bool isSettingLevelUp =false;

	//The hero stats example : the Hero health points
	public int healthPoints = 100;
	public int manaPoints = 100;
	public int spellEfficiency = 3;
	public int meleeEfficiency = 3;
	public int dodgePercent = 3;
	public int blockPercent = 3;
	public int level = 1;
	public int actualXP = 100;
	public int neededXP = 1000;
	public int money = 0;

	//The hero GEAR stats , example : The hero weapon damage
	public int weaponDamage = 5;
	public int weaponSpellDamage = 0;
	public int meleeDamageReduction = 0;
	public int spellDamageReduction = 0;

	//Elemental resistances , example : Lightning damage reduction in percent
	public int lightningReduction = 0;
	public int fireReduction = 0;
	public int iceReduction = 0;
	public int chaosReduction = 0;
	public int lightReduction = 0;
	public int massReduction = 0;


You basically want to write an Editor that has a dropdown on the left and a value to be entered on the right? Well you would need to use Reflection to get a list of the names and the types of the variables and then create a Popup with the variable names you found and when one is selected you would use the field type from the reflection to create the desired editor. It’s quite a bit of work.

Other points - your isXXXXX variables look like a state to me, if they are you’d be better off using an enum to describe - unless you can be in multiple of those at once. I’d consider putting all of this in a utility class rather than a MonoBehaviour and perhaps consider things like weapons to be a further class so that you could swap in new details when the hero collects things. Certainly I guess you will need functions or properties to lookup the final value of things like fireReduction and weaponDamage if you have items that might positively or negatively influence them.