Pages

Monday, January 14, 2013

Unity3D + C#: Acquiring the length of an Enum


Acquiring the length of an Enum:

int enumLength = System.Enum.GetValues(typeof(nameSpace.type)).Length;

Replace the "nameSpace" to the source (script name) of the Enum type, and "type" to the Enum type.

Source:

No comments: