You've successfully subscribed to Hacking with Unity - Learn how to create your own games
Great! Next, complete checkout for full access to Hacking with Unity - Learn how to create your own games
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info is updated.
Billing info update failed.

How to define and use enum in Unity using C#

How to define and use enum in Unity using C#

Ben

// define an Enum type 
public class GamePlayer : MonoBehaviour {

    enum Direction {
		North, 
		East, 
		South, 
		West
	};
	
	public Direction direction;

	void Start() {
		this.direction = Direction.North;
	}
}

Ben