I updated to 2022.3.13f1 from 2022.1 beta and now when I use SetTile(position, null), and then call compositeCollider2D.GenerateGeometry(), it will not remove those old tiles.
NOTE: I have the composite collider set to manual when I call GenerateGeometry method. Then I set it back to synchronous.
Was there any major updates to the composite collider that would stop this from working?
here is a video:
e1cxhd
You can see when I go to triangle, the breakable blocks tilemap will correctly update its collider. Its useByComposite is false.
Then I turn back to circle. I call GenerateGeometry on the Terrain Tilemap’s composite collider. However, you can see that it didn’t remove those tiles that were set to null.
Actually, the video is really confusing and not clear at all so I’m not following what it’s showing. Too much cursor waving and flicking between things.
Terrain Tilemap (parent) and Breakable blocks (child). The parent has a composite collider 2D and the child is set to useByComposite.
You are a circle. You can see the breakable blocks lined up to the right side of the circle. I turn off the breakable block tilemap renderer and show the collision
I turn to a triangle. This breaks some of those blocks using SetTile(position, null). You can see that they are gone from the collision.
I turn back to circle. You can see useByComposite is rechecked on the breakable blocks So this means that the parent tilemap which has the composite collider 2D should rebuild its collision and not have those 2 tiles.
I then show the terrain tilemap. Those 2 blocks that were set to null are still in the composite collider 2D. This only stopped working when I updated from 2022.1 to 2022.3
I’ll have to take your word for it about those physics shapes because the low-res video isn’t showing the shape outlines very well at all and I only occasionally see some faint bits of green lines. I see the cursor pointing and things changing in the inspector but cannot see much in the scene which is the most important thing to see.
All I can see are a few faint lines about 20 seconds in. Do you know there’s a collider fill mode for gizmos? They would be very clear then in any resolution.
I presume if you take off the Composite then you see the physics shapes?
Regardless, I’m sure the Tilemap dev will investigate here though given your report.
Nope. There’s been a lot of tilemap changes though.
The composite being enabled on a collider is nothing to do with the composite, the control is entirely up to the collider in question to get the work done by adding/removing things to/from the composite. This means, if the above is not working then it’s the TilemapCollider2D that is at fault here, not the CompositeCollider2D. This is why I suggest this is something the Tilemap dev can/will look at.
Doing each tile change immediately is expensive. Doing them all in a queue then processing in one go would be much faster, especially if you’re also using the CompositeCollider2D.
Thanks for the info! You’re right, that isn’t a new variable.
Using ProcessTilemapChanges doesn’t work either. The only way I can get it to work is to set maximumTileChangeCount to 0. Something seemed to change on the backend between 2022.1 and 2022.3.
I don’t think there is any performance drops because I do set the compositeCollider2D to manual generation instead of synchronous. Then I can GenerateGeometry when optimal.
The code looks fine to me and does indeed process the tile changes which are queued. If the number of changes exceeds the maximum queue size then it simply recreates the whole collider for the same effect.
I just did a quick test and it seems to work too so not sure what’s going on there for you.