- Home /
Unity Script Parameters and enum ?
I am Currently Learning Scripting with UnityScript and I dont Understand parameters I want to know what are parameters and are they needed does every function has its own parameters or when you need them and the second thing is when i was following one of Desing3 AI tutorial he wrote enter code here
enum AIStatus {Idle = 0, Scared = 1}
what is enum for ???
Answer by BergMarques · Aug 06, 2013 at 08:55 PM
About parameters: you use parameters to send values(bool, int, float) to functions which will work to do actions. This values will return "new" values depending what your function do. you can see more here: http://msdn.microsoft.com/en-us/library/0f66670z.aspx
About enum you can see here: http://msdn.microsoft.com/en-us/library/sbbt4032.aspx
Answer by Xtro · Aug 06, 2013 at 08:30 PM
Enum is used to give meaningfull names to numbers.
for example, when we need to store the sex of a person, we can store it as 0 or 1. But this doesn't make sense. So we create an enum for sex.
enum Sex { Man, Woman };
from now on, we can use Sex.Man instead of 0 and Sex.Woman instead of 1. Compiler understands and translates our enum to assembly code as a number.
Btw, these are very basics of programming. I think you shouldn't ask this in here. You can use StackOverflow or other programming platforms.
if this was helpful, pls don't forget to mark it as answer. Thank you.
Your answer
Follow this Question
Related Questions
C# Parameter questions 2D game 1 Answer
Where to Learn To Script 1 Answer
Multiplayer Script error 2 Answers
Importing the Island Demo 1 Answer
Creating A wall Jump 0 Answers