private void SetTileScriptData(TileEntity tileEntity, Vector3Int pos, float elevation, float height) { tileEntity.Position = pos; tileEntity.elevation = elevation; tileEntity.height = height; for (var i = hexVisualsData.Count - 1; i >= 0; --i) { if (elevation < hexVisualsData[i].startHeight) { continue; } var randomVisual = hexVisualsData[i].items[Random.Range(0, hexVisualsData[i].items.Count)]; tileEntity.SetSideMaterial(randomVisual.sidesMaterial); tileEntity.SetTopMaterial(randomVisual.topMaterial); break; } tileEntity.AlignToGrid(); }