Only in JavaScript, variables can have an unspecified type. This only occurs if you don't assign a value or specify a type while declaring the variable.
JavaScript: The type specification is not necessary.
var playerLife : int; // statically typed (because type specified) var playerLife = 2; // statically typed (because type is inferred from valueassigned) var playerLife; // dynamically typed (because neither a type or value is specified)
The dynamically typed variables will cause slower performance, and you can run into casting problems. You can use #pragma strict
, including it at the top of a script, to tell Unity to disable the dynamic typing in the script and report compile errors when this is a dynamic type in the script.
3.137.217.95