I created a Tilemap with a tilemap collider. I have a player character that has a BoxCollider2D and a RigidBody2d which is Dynamic. The hero moves using the rigidbody2d as “rb” and some Vector2 “v”: rb.MovePosition(v).
In the editor this system works fine: the character moves and bangs into the wall tiles. But when I build the game, the wall colliders have no effect. The hero moves through walls. What’s the problem here? Why is the behavior different between the editor and the build? This is with Unity 2017.2.0f3, WebGL build.
1 Like
I did some digging. For anyone finding this later: apparently you need to select the textures you’re using for your tiles, and in the Inspector, in the “Advanced” section, mark them as “read/write enabled”. It worked for me.
There is no proper documentation for this bit of voodoo, and it makes no sense that Unity’s editor doesn’t work the same way as the build, because that defeats the purpose of having an editor. Notice by the way that in the video series about a platformer using tilemaps, they’re using some weird custom movement code that doesn’t handle colliders normally. This problem is an unfixed Unity bug.
This solution was VERY useful to me. Thank you to KrisSchnee
To help others find this setting more easily, here is an image of the setting in Unity 2020. I clicked on the tilemap image in my assets, then went to the settings in Inspector.