Provide enum constructor that takes an integer and converts it to an enum of the constructed type
Merlin
As far as I can tell, there is currently no way to convert an integer to its equivalent enum value of a specific type.
The specific case that I ran into is that there is no way to do something like `HumanBodyBones bone = (HumanBodyBones)18; if I wanted to get the bone for the right hand for instance. You can't just reasonably use HumanBodyBones.Hand in many cases, for instance iterating over all potential values in an enum is not possible at the moment as far as I know due to this.
Log In
Merlin
Another issue where this prevents people from being able to do something is when you use a bitwise operation on two enum flags and try to use the result. Specifically it's an issue when setting constraints on a rigidbody like in the example given here: https://docs.unity3d.com/ScriptReference/Rigidbody-constraints.html U# would be able to convert the enums to int under the hood to do the OR via a System.Convert function but since it can't convert back to an enum, you can't set the constraints property.