- Home /
How declare values in C#
function Start() { // Store a bunch of different positions in an Array: var aPositions : Array = [new Vector3(0,0,0), new Vector3(1,2,1), new Vector3(2,1,1), new Vector3(2,0,0), new Vector3(0,3,0)];
var rot : Quaternion = Quaternion.identity;
// Loop as many times as there are elements in the aPositions Array:
for(i=0; i<aPositions.length; i++)
{
Instantiate(myCube, aPositions[i], rot); // Put a new cube on the screen using the i'th position
}
}
Not sure I understand your question. Could you please elaborate.
Actuallly i wants to write this in C# Script But i faild,plz help ans yes i am very new to c# Array: var aPositions : Array = [new Vector3(0,0,0), new Vector3(1,2,1), new Vector3(2,1,1), new Vector3(2,0,0), new Vector3(0,3,0)];
Answer by perchik · Aug 28, 2013 at 08:34 PM
C# syntax is
Quaternion rot = Quaternion.identity;
int i = 5;
etc.
To use an array, look at the C# documentation
Your answer
![](https://koobas.hobune.stream/wayback/20220613113150im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Redim a variable 3 Answers
How should I declare a nested class to find it latter with SerializedObject.FindProperty? 1 Answer
name of script to declare 1 Answer
C#: Declaring a script as a variable 1 Answer
C# - Appropriate place for constants, variables, declarations, and initializations. 0 Answers