Hi guys,
Just starting out with Unity coding. Can someone point out my error please? I want to pass in 2 integers, to retrieve the vector3 co-ordinates.
I thought declaring the fieldPos at the start would make it global to the class?
Vector3[,] fieldPos = new Vector3 [21, 42];
void Start () {
InitialiseField();
}
private void InitialiseField () {
int x, z;
blah...
}
public Vector3 GetCoOrdinates(int x, int z) {
Vector3 coOrdinates = new Vector3();
coOrdinates = fieldPos(x,z);
return coOrdinates;
}
The error is on line 15, variable out of context.