I have an issue with how the Tilemap works in build, using version 2022.3.
I update my Tilemap with Tilemap.SetTile(Vector3Int pos, null)
and it works just fine in Editor.
But in build, it won't update visually. It updates the collider, and player can move through virtually inexistent tiles, while they still being visible. Neither editor nor build throws any errors. Attaching screenshots of Inspector window for Tileset in question and Hierarchy window for Grid. As well as video demonstrating the issue.
Videos:
Editor - https://youtu.be/O5R-vt5KMAo
Build - https://youtu.be/pGal2Bpk7L4
Code snippet:
void Update(){
if (isUnlocking){
if (unlockCounter < 0f){
for (int i = 0; i < sizeX; ++i){
gates.SetTile(new Vector3Int(startTilePos.x + i, startTilePos.y - rowCounter, startTilePos.z), null);
}
rowCounter++;
unlockCounter = unlockSpeed;
Vector2 impDir = Random.insideUnitCircle.normalized;
impulser.m_DefaultVelocity.x = impDir.x * 0.1f;
impulser.m_DefaultVelocity.y = impDir.y * 0.1f;
impulser.GenerateImpulse();
audioplayer.clip = door_open;
audioplayer.Play();
}
unlockCounter -= Time.deltaTime;
if (rowCounter == sizeY && unlockCounter < 0f){
Destroy(gameObject);
}
}
}