Show enum in a loop in on GUI

Hello I want too show my enum on a GUI button for each enum what would be best way of doing this a for loop or a foreach loop?

I’d look at enum.GetNames if you’re in C#

The example on that page is pretty much what you want to do, just iterate over all the names and make a button for each one.

EDIT 2: Replaced using System; with using Enum = System.Enum; to avoid using the whole system library

EDIT 1: Here’s some code.

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Enum = System.Enum;
public class Test : MonoBehaviour
{

    public enum Shapes { Triangle = 3, Square = 4, Circle = 10 };
    private Dictionary<string, bool> shapeBtnClicks;

    void Start()
    {
        shapeBtnClicks = new Dictionary<string, bool>();
        foreach (string name in Enum.GetNames(typeof(Shapes)))
        {
            shapeBtnClicks[name] = false;
        }
    }

    void OnGUI()
    {
        foreach (string name in Enum.GetNames(typeof(Shapes)))
        {
            shapeBtnClicks[name] = GUILayout.Button(name);
        }
        
        if (shapeBtnClicks["Triangle"])
        {
            //Do something;
        }
    }
}