Hi,
New to Unity. I have some a script to do set up which is called by SceneManager.Start. however, script is exited to do GameController.Start before script is finished. It gets through a for loop before exiting. If I put the code in the Start function instead of calling in separate function, it gets done.
Code works fine in non-unity Visual Studio c# project.
What am I doing wrong? Thanks
//here is the code, thanks, there are a half dozen more functions, but exit takes place as marked.
using UnityEngine;
using System.Collections;
public class SetUpGame : MonoBehaviour {
public static bool[,] LocationHighlighted = new bool[12, 10];
public static bool[,] LocationChecked = new bool[12, 10];
public static void StartNowx()
{
ClearHighlights();
ClearLocationChecked();
}
public static void ClearHighlights()
{
for (int z = 1; z <= 12; z++)
{
for (int x = 1; x <= 10; x++)
{
LocationHighlighted[z, x] = false;
}
} ////exits after the first 10, ie, z=1, x= 1-10, doesn't increment z, exits the script
}
public static void ClearLocationChecked()
{
for (int z = 1; z <= 12; z++)
{
for (int x = 1; x <= 10; x++)
{
LocationChecked[z, x] = false;
}
}
}