- Home /
UI buttons and text are being shown as black area
Hello, I am working on a game in Unity3D 5.0.2 and I faced a problem when I switch between scenes. My UI elements are turned into a black area. I have attached the screenshot. Thank you!
im guessing its the shader you used. I think one of the options is called text shader or osmething along those lines, however it doesnt actually work like its supposed to. if you want your buttons to have text either make a texture with text on them, or use that shader but make sure there is no material set for the text material (thats why its co$$anonymous$$g out those weird white blocks. ALSO, your scene looks dark as hell did you add a directiional light to it?
I am using Unity3d native UI elements, buttons and texts.
did oou add the directional light? the way i usually go about this is put the text on a seperate texture made in photoshop or gimp or whatever write the text you want to display on that texture, import that texture and apply it to a material, give that material a standard shader, then put that on the gameobject acting as the button.
The problem isnt about not using light in your scene.
$$anonymous$$y guess is that there are duplicates underneath each button. Resulting the boxes to appear as a black area. Does your script destroy these UI elements on loading another level? and/or does your script recalls the function to render these buttons when re-entering the same scene?
Answer by shomeser · Aug 25, 2016 at 08:23 PM
I've faced with the same problem. My Unity version is 5.4.
I just re-import all assets by selecting menu Assets -> Reimport All
and the problem disappeared.
Had the same problem - this was the only thing that worked. Now I have an issue with Unity Ads working fine in dev and iOS - not not showing up in Android. Any thoughts on this?
Hey! Thanks a lot. Dunno when or why this happened, but this fixed it. I'm on 5.4 as well.
Answer by commodore · Nov 10, 2015 at 06:44 PM
Little late but I fixed this problem by making sure the source image on UI elements actually had an image and wasn't "none"
Answer by YarivAtias · May 20, 2017 at 08:48 AM
I had this problem too. I found that I need to prompt unity to 'Refresh' the meta file of the .texture file that was black area.
So only refreshing the meta file: 1. Open UnityEditor, 2. Click on the texture file that appears as black area 3. In the inspector, click on 'wrap mode', and set it again to the value that is set. for instance, if wrap mode is 'Repeat', click on wrap mode combo box and set 'Repeat'. 4. click 'apply' in the inspector. 5. List item
In the end of this steps, the .meta file was changed, event though I didn't change any value in the Inspector. I think it implies that Unity treated the old .meta as corrupted for some reason. I n my case I suspect that the old .meta file was generated in an older version of Unity and once I loaded it to in a new version of Unity, then Unity treated it as corrupted.
Your answer
Follow this Question
Related Questions
Vertical Layout Group, how to set different child aligments 2 Answers
How To Assign List Elements To Array Elements? 2 Answers
Any way to control the visibility of UI stacked elements? 1 Answer
Build for android: everything is black except UI, works on other phone 1 Answer
How to setup TextMesh Pro Font Asset to include characters from all languages? 1 Answer