Hi,
Suddenly I started getting this error. (possibly after a collider update to one of the prefabs).
NullReferenceException
tk2dRuntime.TileMap.BuilderUtil.HideTileMapPrefabs (.tk2dTileMap tileMap) (at Assets/TK2DROOT/tk2dTileMap/Code/tk2dTileMapBuilderUtil.cs:280)
tk2dTileMap.ClearSpawnedInstances () (at Assets/TK2DROOT/tk2dTileMap/Code/tk2dTileMap.cs:225)
tk2dTileMap.Build (BuildFlags buildFlags) (at Assets/TK2DROOT/tk2dTileMap/Code/tk2dTileMap.cs:304)
tk2dTileMap.EndEditMode () (at Assets/TK2DROOT/tk2dTileMap/Code/tk2dTileMap.cs:526)
tk2dTileMap.Awake () (at Assets/TK2DROOT/tk2dTileMap/Code/tk2dTileMap.cs:117)
UnityEditor.DockArea:OnGUI()
After debugging the code
for (int i = 0; i < instListCount; ++i) {
int x, y, layerIdx;
GameObject instance;
tileMap.GetTilePrefabsListItem(i, out x, out y, out layerIdx, out instance);
// Is it already IN the list for some reason?
if (!instExists) {
int tileId = (x >= 0 && x < tileMap.width && y >= 0 && y < tileMap.height) ? tileMap.GetTile(x, y, layerIdx) : -1;
if (tileId >= 0 && tileId < prefabs.Length && prefabs[tileId] != null) {
instExists = true;
}
}
if (instExists) {
tileX.Add(x);
tileY.Add(y);
tileLayer.Add(layerIdx);
tileInst.Add(instance);
tk2dUtil.SetTransformParent(instance.transform, tileMap.PrefabsRoot.transform);
}
}
in this line: tk2dUtil.SetTransformParent(instance.transform, tileMap.PrefabsRoot.transform);
instance is null.
How to find a broken tile ?