Here is all of the code I have in the script in question:
#pragma strict
var grid = new boolean[0,0];
function Start () {
var terrainSize = GetComponent(Terrain).terrainData.size;
grid = new boolean[terrainSize.x, terrainSize.z];
}
function getGrid (x, y) {
return grid[x][y];
}
function setGrid (x, y, aValue) {
grid[x][y] = aValue;
return null;
}
The problems I am having are:
1: I can’t find a way of initialising grid within ‘Start’ and also making it ‘global’. ie, accessable in setGrid and getGrid, not in other scripts.
2: Using what I am at the moment causes this error:
Assets/Scripts/TerrainManagement.js(15,20): BCE0048: Type ‘boolean’ does not support slicing.
and another for the second grid[y]
Javascript novice, sorry for silly questions.