Tiles not rendering when game is built

Hi,

I have been making a 2D game and have been using sprites and tilemaps to render my charcter and levels. In the unity developer, both scene and game view the game works just fine, but whenever I build the game to test it, none of the tiles will render and only the player sprite will be visable. The tiles are still there as they have collision but they are not rendering for some reason.

I have tried using the legacy sprite packer and a sprite atlas to solve this issue but no matter what I try I cannot get the sprites to render in buids, even though it works perfectly fine the the developer.

I have only started having this problem once I used a sprite atlas as old versions work just fine, but now it doesnt work at all regardless on if I delete the atlas turn of sprite packing in the project settings.

Any help or suggestions would be appricated as I am relativily new when it comes to creating builds in unity.
For referance, I am using version 2019.3.0a2

I found the soloution myself and I’m going to describe what I did just in case somebody else has a similar issue as I personally had a hard time finding a similar case.

The error seemed to step from a curroption in my project library folder as because I had been messing around with the legacy tile packer and tile atlas I may have caused an error with how unity was storing where to call the sprites from. The “Game View” in the Unity editor uses the assets for sprites used in the game from your assets folder, but when the game is built, unity accesses the sprites from the library folder. Because of this, my game worked fine in the Game View but didnt work when built as the error was in the library folder as that was where the issues lay.

To fix the error in the library you can delete it and unity will rebuild it. Since all data in the game is stored in the assets folder no information in the project or scenes will actually be lost. To access it, locate the folder that you saved the project (for me this was in Documents > Unity > NameOfProject, but it may be different for you) Inside the project folder is the library folder.

Before you do anything, make sure to save and close the editor, then delete the library folder and re-open the editor. Unity will then automatically re-make the library folder. You may notice that the view in the editor is empty but that is because all your scenes will be closed and will have to be re-opened from the assets folder. Once you have the scenes you want opened, go into build setting and make sure that all scenes you want to build are selected. Once done, you should hopefully find that it fixed the issue as it did so for me.

I’m not going to claim that this is a concrete or good soloution as I am not very experienced with Unity, but it worked in my case and if you have a similar problem like me do try and re-make your library folder as it may solve the issue.

1 Like

I had a similar problem. Ended up I had followed an online tutorial to set up my own render asset, and the material assigned to some of my tilemaps wasn’t compatible with it. Once I changed the material to one that I noticed was working, things rendered in the game view.