Enum ints not stable

Godot Version

4.2.2

Question

enum Hair { 
	SHORT, 
	SIMPLE, 
	MESSY,
	MESSY_WITCH,
	SEASTAR, 
	GROOMED,
	BEDHEAD,
	BALDING, 
	SIDE_FRINGE, 
	MEDIUM,
	BALD,
	BASE 
}

I’m using this enum here and added a new hairtype here in the middle of the definitions. then the numeric ids got mixed up (I think). so my selected values for the HairType inside my resources have a lot of wrong references now.

Can I change it so it uses stable strings instead of ids? Make the ids stable somehow?

You can manually assign values to enums

enum Hair { 
	SHORT = 0, 
	SIMPLE = 1, 
	MESSY = 2,
	MESSY_WITCH = 3,
	SEASTAR = 4, 
	GROOMED = 5,
	BEDHEAD = 6,
	BALDING, 
	SIDE_FRINGE, 
	MEDIUM,
	BALD,
	BASE 
}
4 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.