Day 102 — C# Fundamentals: Enums

public class GraphicsSettings : MonoBehaviour
{
public enum GraphicsSelector
{
Low, // 0
Medium, // 1
High, // 2
Ultra // 3
}
}
public class GraphicsSettings : MonoBehaviour
{
public enum GraphicsSelector
{
Low = 3,
Medium = 10,
High = 1,
Ultra = 0
}
}
public GraphicsSelector currentSetting;
private void Start()
{
switch (currentSetting)
{
case GraphicsSelector.Low:
Debug.Log("Low settings selected!");
break;
case GraphicsSelector.Medium:
Debug.Log("Medium settings selected!");
break;
case GraphicsSelector.High:
Debug.Log("High settings selected!");
break;
case GraphicsSelector.Ultra:
Debug.Log("Ultra settings selected!");
break;
default:
break;
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class SelectLevel : MonoBehaviour
{
public enum LevelSelector
{
Artisans,
Peacekeepers,
MagicCrafters,
BeastMakers,
DreamWeavers
}
public LevelSelector chosenLevel; private void Start()
{
SceneManager.LoadScene((int)chosenLevel);
}
}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Connor Fullarton

Connor Fullarton

Hey and welcome! My name is Connor and my goal here is to put out a daily post for a full year about my game development journey.