Game Development Reference
In-Depth Information
Type names
A couple of the basic types are spelled differently in pure Unity C#. In JavaScript, we use
Boolean
and
String
, but in pure Unity C#, we use
bool
and
string
, as shown in the
following code:
// JavaScript user:
var isHit : Boolean; //The space between ':' isn't
necessary.
var myName : String;
// C# user:
bool isHit;
string myName;
However, there is an exception. If you include
System
in your C# script, you will be able
to use .NET's
String
and
Boolean
classes (uppercase) as shown in the following script:
// C# user:
using System;
Boolean isHit;
String myName;