- Home /
Enum-Variable with float
Is there a way to declare an enum-variable carrying float-variables? This site says the variables are constant integers by default: JavaScript Enum.
So my question is: Can I make something like this?
enum axesvar {x, y, z};
axesvar.x = 10.3;
axesvar.y = 5.1;
axesvar.z = 5.2;
The variables of course shall not become constants.
Answer by spacepilot · Jan 08, 2012 at 05:06 AM
Even though the command struct exists in JavaScript, it doesn't work with Unity-Javascript!
A possible workaround is here.
Therefore I dis-marked the other answer as correct.
Furthermore, the workaround doesn't seem to be clean and is still causing me trouble. New threat is here: How to use struct-variables as return-values of functions
I deleted my answer due to my insufficient knowledge of UnityScript.
Your answer
Follow this Question
Related Questions
Possible to use an array value as the name of a variable? 2 Answers
How do I use an enum value as a variable? 3 Answers
Can I declare a variable inside a function which has instance scope? 1 Answer
Which variable can be implicitly declared? 1 Answer
Trying to call a variable from another script in C# 1 Answer