- Home /
Scripting Tutorial
hi will someone explain the use of the following stuff :
pragma strict , what is it for ?
the colon : like why don't we write var myint=5; instead of var myInt : int = 5; i can't get the second one
also the use of update and start function am i obligated to use them ?
thanks in advance and sorry for my bad english
Answer by DaveA · Feb 08, 2014 at 08:38 PM
Pragma strict will enforce good programming habits. It makes your project easier to port to other projects and other platforms.
Using the type (with the colon) tells the compiler what the type is, so it doesn't have to figure it out when running, making for more efficient code. It's also needed when porting to mobile platfoms. And it's just a good habit.
You don't have to use Start or Update if you don't need them. Most MonoBehaviors you write will probably need them, but it's not a requirement. If you really don't use them, don't even implement them.
Your answer
