Sprites missing on build

Hey guys, this is a really really annoying thing that has been questioned before, but as far as i know, none of the questions have an answer that solves the problem. I am making an FPS, and it is almost finished. I am talking about 2 weeks of work, and i am very frustrated by this minor problem that is basically ruining my project. In my game, i always have two Canvas. The standard canvas that show some images and a timer, and what i conveniently named “Sub-Canvas” for my character, that display health and ammo. My problem is that after building the game, both canvas basically don’t work. The sprites became square and purple (missing material). What am i supposed to do? I’ve searched a LOT and found only things like layer order and script order but this really don’t work. What do i do? I can’t play with those purple things on the screen, and it is very disorienting and “Unplayable”.

I found an answer for it. Finally… At least i hope this answer will help someone, because i know that someone will have this problem in the future, like a lot of people did in the past.

In the end, i didn’t discovered what was the cause of the bug, and as i can’t configure the build i can’t know why is it happening, but i tried this, and it might help you, who knows:

1- Creating and moving the images to a folder named “Resources”.
2- Reimporting the Images.
3- Deleting and creating another Canvas.
4- Dragging the Images to the screen as GameObjects and making another build.
5- Trying with other images.
6- Unninstalling and Reinstalling Unity.
7- Adding ui shaders to exceptions (always load).
8- Changing script order.
9- Adding shaders to load on start.

If none of these work, and they probaly won’t, this fixed my problem:

Create a material for every sprite you are having this bug, and add the image to it. Then change the material’s shader to UNLIT > TRANSPARENT. Then, in your canvas, apply each material to it’s image. For some reason, after building the project, these materials will not be deleted. This is a quick fix, but of course i am still having problems with texts and it’s just annoying to use one material to each image, but that’s the only thing that worked.

I sincerely hope this will NEVER happen to you.