Game Development Reference
In-Depth Information
// JavaScript user:
class MyClass {
var myVar = 1;
function MyClass() {
Debug.Log("Hello World!");
}
}
// C# user:
class MyClass {
public int myVar = 1;
void MyClass() {
Debug.Log("Hello World!");
}
}
Note
If you are inheriting from
MonoBehaviour
, you should not use constructors or de-
structors. Instead, use the event handler functions such as
Start()
,
Awake()
, and
OnEnabled()
.