Hi - so i’m having a problem with my multidimensional array.
I need to sort my field in an array sorted by:
rows
rows[0] = gameTile[1,2,3,4,5,6];
rows[1] = gameTile[1,2,3,4,];
And so on.
This is the code:
function OnLevelWasLoaded()
{
levelWon = false;
temporaryGameTiles = GameObject.FindGameObjectsWithTag("Game Tile");
temporaryRows = GameObject.FindGameObjectsWithTag("Row");
temporaryStartIndicators = GameObject.FindGameObjectsWithTag("Start Indicator");
touchIndicator = GameObject.Find("Touch Indicator");
for(var v=0; v < temporaryRows.length; v++)
{
var a = v+1;
//gameTiles[v] = new Array();
//var gameTiles : GameObject[];
for(var u=0; u <temporaryGameTiles.length; u++)
{
for(var i=0; i < temporaryGameTiles.length; i++)
{
var b = u+1;
if(temporaryGameTiles*.transform.name == "Game Tile "+a+"."+b)*
-
{*
_ rows[v,u] = temporaryGameTiles*;*_
* }*
* }*
* }*
}
my row variable is defined as:
var row : GameObject[,];
The error i get is:
NullReferenceException: Object reference not set to an instance of an object
GameScript.OnLevelWasLoaded () (at Assets/Scripts/GameScript.js:96)
Theres nothing wrong with temporaryGameTile*; i have debugged this many times.*
Please help