Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing a TileSet while project is running breaks Area2D collision #45633

Open
Tracked by #45334
Hex4F opened this issue Feb 1, 2021 · 2 comments
Open
Tracked by #45334

Changing a TileSet while project is running breaks Area2D collision #45633

Hex4F opened this issue Feb 1, 2021 · 2 comments

Comments

@Hex4F
Copy link

Hex4F commented Feb 1, 2021

Godot version:
3.2.3

OS/device including version:
Windows 7

Issue description:
Rapidly calling TileSet.tile_set_region seems like a convenient way to handle animated tiles, but doing so causes Area2D collisions with TileMaps using that TileSet to become strange and inconsistent. This isn't an issue specific to setting the tile's region or collision: even more innocuous changes such as cycling the color with tile_set_modulate will cause it. After stopping the repeated calls, the problem immediately goes away.

Are TileSets not intended to be changed so quickly? I couldn't find any mention of this. I hope not, because it's a simple and convenient way to implement a bunch of different tile effects. AnimatedTextures are very rigid in contrast (and caused irreproducible bugs for someone I'm working with).

Steps to reproduce:
Repeatedly change a TileMap's TileSet while an Area2D is colliding with it.

Minimal reproduction project:
ExitedEntered.zip

@Calinou
Copy link
Member

Calinou commented Feb 1, 2021

Rapidly calling TileSet.tile_set_region seems like a convenient way to handle animated tiles,

This is a bad way to do it performance-wise. Look into using a shader instead.

@Hex4F
Copy link
Author

Hex4F commented Feb 2, 2021

This is a bad way to do it performance-wise. Look into using a shader instead.

Done. Thanks for the fast response.

I'm curious as to why that is, though. Does changing a TileSet force some kind of cache to be rebuilt? I didn't realize moving the region would be more expensive than sending a UV offset (or indexed table of them) to the tiles' shader materials.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants