Okay so, I Have an int array called tTileTypeMap as seen bellow;
[SerializeField]
public int[,,] tTileTypeMap;
I use a function called Create map that i call from a custom editor button and that works fine (I used debugs to check that its there and the data is correct) My code is bellow
public void CreateMap()
{
if (gridSizeZ <= 0 || gridSizeX <= 0 || MapSize <= 0 || brushes.Count < 0)
return;
int y = 0;
for (int x = 0; x < MapSize; x += gridSizeX)
{
for (int z = 0; z < MapSize; z += gridSizeZ)
{
tTileTypeMap[x, y, z] = 0;
}
}
}
But when I start play mode, I get a null error and it no longer exists!
Things I have tried so far that don’t work.
- [SerializeField] - the verible
- [System.Serializable] - the class
- Passing the array to a script able object
- UnityEditor.EditorUtility.SetDirty();
Thank you in advance for any and all help! I have been stuck on this for a hole day!