Unity Ninja Unity 3D Forum
To have exclusive access to all downloads, recourses and links within this forum, a free registered account is required. Just a heads up Wink

You are not connected. Please login or register

Unity Ninja Unity 3D Forum » Tutorials » Helpful Enumeration Tutorial (Javascript == true)

Helpful Enumeration Tutorial (Javascript == true)

View previous topic View next topic Go down  Message [Page 1 of 1]

DeveloperLuke


Moderator
Moderator
Hello, and welcome to my Enumeration tutorial. Today I will teach you how to make enums in javascript.
so i will start out with how to make an enum var.

enum ThisIsTheEnumVarible{Name,Name,Name,Name,Name}

This will not show up in the editor because it is not a real var.
you can make an enum var with doing this.

Code:
enum nameofenumvar{enum1,enum2,enum3}
var Var1 : nameofenumvar;

that is how you make the dropdown bar. so now i will teach you how to test if it is one of them.

Code:
if(Var1 == nameofenumvar.enum3) {
   print("you are on enum3");
}

next is how to set the enum in javascript.  

Code:
nameofenumvar = nameofenumvar.enum2;

Thanks for reading. please comment and ask what i should do in my next tutorial.

                                      Thanks Wooden What a Face

View user profile

Ninjaboy follower


Member [Lv. 3]
Member [Lv. 3]
Nice... Very helpful for people who use JS

View user profile

NewDeveloper


Moderator
Moderator
Hey Wooden, this is great but its also in the wrong section of the forum, should be in the Tutorials section.

--New Developer

View user profile

DeveloperLuke


Moderator
Moderator
Ok Sorry next time i will post my Tutorials on Tutorials section.
--Sorry, Wooden Sad

View user profile
No problem wooden, I'll just move the topic. Thanks for posting and helping out the community!

View user profile http://www.youtube.com/user/misterninjaboy

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum