Hey guys, I like to solve some doubts.
I have a script, called RandomRoom, and that have three enums called RoomType, RoomEntrance and RoomExit. I like to know if there is a way to choose an enum and other options enum appear in the inspector
Hey guys, I like to solve some doubts.
I have a script, called RandomRoom, and that have three enums called RoomType, RoomEntrance and RoomExit. I like to know if there is a way to choose an enum and other options enum appear in the inspector
An enumeration can surely appear in teh inspector.
You shoudl ahve a gameobject that is being inspected. In this object, attach the script that holds the enumeration (the room script I suppose). You will want to have somethign like this:
Public RoomType MyRoomType = RoomType.whatever;
Public RoomEntrance MyRoomEntrance = RoomEntrance .whatever;
etc…
When you click on your game object and look in the inspector, you should see a property called My Room Entrance and next to it there will be a drop down with your values. I use this quite often as it is a nice clean way to give the user options.
If you do this and you do not see the value in the inspector, make sure your variable is marked as public, and if there is still a problem, add [Serializable] above your enumeration.
If [Serializable] is showing a reference error, you can right click the text and then select resolve, and then click the first option. It will automatically add the using statment for you.
If you still run into trouble, post your script and I would be happy to help.