You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that if colliders are enabled on shared tilemaps when we copy individual room templates, Unity tries to incrementally rebuild them to update their shape. When working with bigger levels, this can cause noticeable lag (up to 10 seconds on levels with hundreds of rooms, 1-2 seconds on medium sized levels).
Based on some quick tests, it seems like it is better to first disable all colliders and only enable them after all tiles are copied to the final level. The difference might not be noticeable on small levels, but it went from 10 seconds to cca 2 seconds iirc. We need to do some additional performance tests.
There are at least 2 possible approaches to handle this:
We can split tilemap layers initialization into 2 stages. In the first stage, we would create tilemaps without colliders and in the second stage, we would only add the colliders. The second stage would be called only after all the tiles were copied. The problem of this approach is that it makes it harder for uses to implement their own tilemap initialization logic because they would need to split the logic.
Before copying tiles, we can go through all the colliders of individual tilemap layers, mark which ones were enabled and then disable them. We would then copy all the tiles and after that we would enable all the collider that were disabled in the previous step. The advantage of this approach is that it is transparent for users. We just have to make sure that there are no problems with disabling and then enabling colliders.
The text was updated successfully, but these errors were encountered:
It seems that if colliders are enabled on shared tilemaps when we copy individual room templates, Unity tries to incrementally rebuild them to update their shape. When working with bigger levels, this can cause noticeable lag (up to 10 seconds on levels with hundreds of rooms, 1-2 seconds on medium sized levels).
Based on some quick tests, it seems like it is better to first disable all colliders and only enable them after all tiles are copied to the final level. The difference might not be noticeable on small levels, but it went from 10 seconds to cca 2 seconds iirc. We need to do some additional performance tests.
There are at least 2 possible approaches to handle this:
The text was updated successfully, but these errors were encountered: