: (colon) in c# for Unity3d

c#, syntax, unity-game-engine

Solution

The sample is in Unityscript (almost same as javascript or actionscript 3). The syntax is littlebit different, than syntax of C#.

Your tip is right. The

var spawnPoints:Transform[];

is in Unityscript and in C# it's exactly

Transform[] spawnPoints;

Problem

I'm new at C# and Unity and reading the Manual and encountered a foreign colon syntax in some examples: ``` function Choose(probs: float[]) { var total = 0; for (elem in probs) { total += elem; } var spawnPoints: Transform[]; function ChooseSet(numRequired: int) { var result = new Transform[numRequired]; ``` It's from Random Numbers Unity3d Manual I found this question: Multiple Meanings of : in c# But no one of the examples in this question seems to fit. I think, it's a kind of type definition... but normally it would be ``` public Transform[] spawnPoints; ``` instead of ``` var spawnPoints: Transform[]; ``` so I'm a little bit confused.

Original source

Related problems