Hi, I am having problems with my UI. For some reason the image component part of buttons is not showing when the game is built (the text shows). It shows fine in the editor, but when i build out the game no background image of the buttons is showing, and i cant figure out why. Does anyone possibly have an idea. Ive tried changing the aspect ratio, changed out the type of canvas renderer mode, added more buttons and ui images, but yet nothing shows. Any help would be appreciated
Here are the official docs on how to make your UI handle various resolutions and aspect ratios cleanly:
Here are some notes on UI Anchoring, Scaling, CanvasScaler, etc:
Usually you need to choose a suitable ScaleMode and MatchMode in the Canvas Scaler and stick with it 100%. Generally if you change those settings you will often need to redo your UI entirely.
I have set the anchoring up a way that it should always show on screen. For testing I even just made a massive button and anchored to the middle of the screen. and still only the text has shown. I think though, it might have something to do with what is being used as the image part of the button, I have a sprite that is set to 2d and UI, and that shows fine as the button, but another sprite (2d and UI) that i have doesnt show as the button. So I am more confused now at what the issue might be.
Well I got it to work but dont think its the correct solution, seems very strange. I need to set the imported image i am using, that is set to sprite (2d ui) to have read/write enabled.
I dont know if this points to a bigger issue in my project, as when i tried to build yesterday none of my materials on the objects were shown, and they had to be set to read/write, however i thought because they were using custom shaders that was the cause. But the button is using just a simple image that i imported, so not being effected by any of my shaders etc.