Last active
January 30, 2022 16:34
-
-
Save farukcan/50efa59b8044a99ddc031e8bf2bdbe19 to your computer and use it in GitHub Desktop.
C# Get All Enum Values
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Example : MonoBehaviour | |
{ | |
private enum TetrisPiece | |
{ | |
Line, Square, T, J, L, S, Z | |
} | |
RandomBag<TetrisPiece> pieceBag; | |
void Awake() | |
{ | |
// Get an array with each value of TetrisPiece | |
TetrisPiece[] tetrisPieceArray = (TetrisPiece[]) Enum.GetValues(typeof (TetrisPiece)); | |
Debug.Log(TetrisPiece); | |
// Example output: | |
// Line, Square, T, J, L, S, Z | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment