Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity UI showing in Editor, but not in Build

Discussion in 'UGUI & TextMesh Pro' started by Senju, Dec 24, 2014.

  1. Senju

    Senju

    Joined:
    Dec 24, 2014
    Posts:
    1
    I should start by saying that I am new to UI in general. Never touched the legacy GUI UI in Unity before.

    I am using the new Canvas UI system. I have set the canvas to 'Render Mode: Screen Space - Camera' and linked the Main Camera to it. I have positioned Text elements to the Canvas and positioned them where I want. Everything looks good when I run in the editor; however, after building and running as a desktop/web app, the UI does not show up.
     
    nitin2007y likes this.
  2. compugraphx

    compugraphx

    Joined:
    Jul 2, 2012
    Posts:
    6
    I'm having the exact same issue. Some images in the UI are visible, but most such as text are not there when opening the build. Everything looks great inside Unity.
     
    nitin2007y likes this.
  3. compugraphx

    compugraphx

    Joined:
    Jul 2, 2012
    Posts:
    6
    Okay, I figured it out for my case. In my case when in the build window (File > Build Settings), delete all the scenes, and re-add only the one you are building (you can re-add all your others too, after you confirm that this works). Since I was using imported library and some files from another directory it was pulling the incorrect scene. See if this works for you.
     
    ducklol37 likes this.
  4. radler470

    radler470

    Joined:
    Dec 3, 2014
    Posts:
    86
    I tried this, and it didn't work. Having the same issue except that my buttons are showing up - just no text, and they are not clickable.
     
  5. radler470

    radler470

    Joined:
    Dec 3, 2014
    Posts:
    86
    I was able to solve my issue by downloading the latest patch. Maybe this is your problem too?
     
    DawsC likes this.
  6. BiscuitJoe

    BiscuitJoe

    Joined:
    May 10, 2018
    Posts:
    2
    2018, this is still an issue.
     
    henry8168, ramhc10, raneemhsj and 3 others like this.
  7. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,664
    I've never experienced this, and have used both the legacy UI system and the newer UI system for many years. Perhaps there is a problem with the particular version of unity you are using? I'd try and download a recent version (2017 or 2018) and see if the problem persists.

    Also - perhaps the scaling of the UI is causing a problem where the UI is so tiny or so large its out of place... try adjusting the canvas to scale with screen size, matching either width or height, and do some testing to see if that helps.
     
  8. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    @BiscuitJoe, did you ever figure this out? I'm trying to help another guy who seems to have a similar problem.
     
  9. geminiradio

    geminiradio

    Joined:
    Apr 26, 2018
    Posts:
    1
    I had a similar problem and found a workaround:

    I noticed that when I manually resized the player window, the UI elements (buttons, in my case) would suddenly appear. So in script, after my UI is established as I want it, I change the screen resolution slightly, which causes the canvas to update correctly the same as if the user had resized the window. (Canvas.ForceUpdateCanvases wasn't working.) Note that I'm running in windowed mode, so this just changes the size of the window - not sure what I would do if I was in fullscreen.
     
    Elite_Champion and Deleted User like this.
  10. af11g11

    af11g11

    Joined:
    Apr 3, 2017
    Posts:
    2
    @geminiradio @JoeStrout @BiscuitJoe did you find a solution to this? Im having the same problem. UI elements all appear as desired if I change the resolution to something else and then back to my default (1080x1920). Main problem is on the built apk on android I can't figure out how to resize the canvas and would not really want to.
     
  11. Frima_FXVezina

    Frima_FXVezina

    Joined:
    Apr 23, 2015
    Posts:
    6
    I just stumbld upon this post while having a similar issue. My problem was that during setup, the Z-Order of one of my buttons was changed and the button was then rendered behind my background.

    So double check the Pos Z of your hierarchy would be my best guess.
     
    dougsavage1 likes this.
  12. lebebop

    lebebop

    Joined:
    Sep 28, 2018
    Posts:
    2
    Hello guys. I have a similar problem. Instead of UI elements, the water (water4advanced) doesnt appear in the build app. Do you have any clue on this?
     
  13. Mengxiao_Yu

    Mengxiao_Yu

    Joined:
    Oct 25, 2018
    Posts:
    3
    I have the same problem. I have a background png image in the UI Canvas. It shows fine in unity but is invisible in IOS. The other gameobjects which are using the same material as background image show normally in IOS. Even the text in UI Canvas shows normally. I don't why the bug for background image happens.
     
  14. Mengxiao_Yu

    Mengxiao_Yu

    Joined:
    Oct 25, 2018
    Posts:
    3
    I have fixed my problem by using the image shader "UI/Default" rather than "Unity/Transparent".
     
  15. itisieric

    itisieric

    Joined:
    Jul 15, 2018
    Posts:
    4
    Fixed
    First, save your scenes then go to (file > Build Settings) and check the right one that you need (don't check the default scene) that worked for me
     
  16. hchoi84

    hchoi84

    Joined:
    Oct 30, 2016
    Posts:
    1
    Struggled with this for literally 2 hours! After reading other people's fixes, I FINALLY found the solution.

    My problem:

    My score UI would show fine within Unity editor with 4:3 aspect ratio. Same with title screen and game over screen. However, once I did a build and played the game, the score UI would disappear. Title screen and game over screen was fine. Frustrating! Almost gave up on Unity for the 58th time LOL!

    What I tried:
    - Change the layout of the Canvas game object
    - Adjust sorting order
    - Change the font color
    - Remove all scenes from BUILD and add it back in
    - Research CS0649 errors to see if that had anything to do with it
    and then, finally!!!

    When I realized my solution at the bottom was going to be the answer:
    Changing aspect ratio from 4:3 to 800x600, I realized my score would disappear. That's when it finally hit me!

    Solution that worked for me:

    1. Resize text area with Rect Tool to make it bigger instead of perfect fit
    2. Within Text >> Inspector, change horizontal/vertical overflow to "Overflow" from "Wrap" so that if the text gets bigger than the designated area, it'll still show up

    Hope this helps someone! Don't give up!! :)
     
    Last edited: Jan 18, 2019
  17. iikkamovitsh

    iikkamovitsh

    Joined:
    Feb 3, 2019
    Posts:
    1
    Hi all,
    Having a similar kind of a problem:

    I use an AR camera to display a model over a TargetImage. I have now implemented two buttons with which I can change between two models. All works perfect inside Unity but when building for iOS I can't see either of the buttons.

    Xcode does bring up some UI error (purple square) but haven't been able to find out what is the problem there or if it is an actual error.

    Any ideas what might the problem be? And to clarify: I'm a beginner in Unity and in coding so if it is not too much to ask, please be thorough in your replies :)

    EDIT: Aaaand now it works. Apparently deleting the scene from BUILD and adding it again worked.
     
    Last edited: Feb 17, 2019
  18. Jebien

    Jebien

    Joined:
    Mar 1, 2017
    Posts:
    1
    Hi all,

    I had a similar problem,

    I could see all my UI elements in Unity but after build they just disappeared. After I manually changed the resolution they appeared but not all of them ( for example text was there only by 800x600 but textmeshpro till 1280x720). What worked for me I changed the canvas render mode to "World space" and now it shows my elements.

    I hope it helps
     
  19. walidbakhouya

    walidbakhouya

    Joined:
    May 4, 2019
    Posts:
    1
    Hi everyone,
    I have the same issue here, I tried all the solutions proposed but no results
    if anybody can help me plz
     
  20. benio33

    benio33

    Joined:
    Jul 22, 2016
    Posts:
    3
    Hello everyone. I had very similar issue recently and none of the above solutions worked. In my case I had an UI element named the same way as different element was named and I was searching for the item by name. For some weird reason Windows in Unity Editor was fine with it, but cell phone just didn't show up the UI. Thank you all for the help though and I hope I could help someone too.
     
  21. Bshow

    Bshow

    Joined:
    Mar 27, 2013
    Posts:
    2
    I have a similar issue. On editor and my phone it works but on bigger resolutions the cards disapper (its a poker game).

    I have tried everything but I can't find a solution
     
    JEONHYESUNG likes this.
  22. gtubridy21

    gtubridy21

    Joined:
    Oct 7, 2019
    Posts:
    1
    I HAVE THE FIX EVERYONE!!!!! If you are looking at your canvas first of all make sure UI scale mode is set to "Scale with screen size". Second off you'll probably notice your screen match mode is set to "match width or height." I tinkered with that and set it to expand instead and it worked. Does look slightly different than I had it but im all right with that. If that does not work then try shrink as well.

    Cheers
     
  23. homer_3

    homer_3

    Joined:
    Jun 19, 2011
    Posts:
    111
    Thanks, man! This was the fix that worked!
     
    araz01 likes this.
  24. araz01

    araz01

    Joined:
    Aug 2, 2016
    Posts:
    53

    pfft this is common sense, what i need to know is why the canvas shop up at all, in any way on the big screen lo
     
  25. andreoapplication

    andreoapplication

    Joined:
    Mar 18, 2020
    Posts:
    3
    solution is change the canvas scaler, scale mode to be scale with screen size and change to x = 1920 and y = 1080
    match 0.5 i hope its fixed
     
    chingwa likes this.
  26. AdaluteGames

    AdaluteGames

    Joined:
    Dec 10, 2012
    Posts:
    31
    My canvas wasnt showing up either until I went to the Canvas and went to Canvas Scalar and changed the UI Scale Model to Scale With Screen Size and made this match the size thats in my Game View.
     
  27. andreoapplication

    andreoapplication

    Joined:
    Mar 18, 2020
    Posts:
    3
    i
    i got the fixed that match width or height change to expand its worked for me
     
    Omikron1 likes this.
  28. andreoapplication

    andreoapplication

    Joined:
    Mar 18, 2020
    Posts:
    3
    omg work
    ed thank you so much broo
     
  29. xxShana

    xxShana

    Joined:
    Jul 4, 2019
    Posts:
    23
    try to use in-game debug console asset to understand where are your error or issue
     
  30. bartofzo

    bartofzo

    Joined:
    Mar 16, 2017
    Posts:
    150
    I was facing the same issue. Some UI images showed up in a build, some didn't. In the editor everything showed.

    Turned out that the Z position of the Rect Transform was some large value for the invisible objects... No idea how that happened but setting it to 0 fixed it for me.
     
    Yoncity likes this.
  31. brian-nielsen

    brian-nielsen

    Joined:
    Apr 18, 2018
    Posts:
    15
    Mine was a bit different than described above. I have a script that instantiates a prefab as a child of a canvas object. A parent with a horizontal layout group instantiates prefabs of images based upon how many of a certain game object are present in the scene.

    This worked in the editor very well. When I built it did not work, even with the fixes above. The fix was putting one of the prefabs into the scene hierarchy and setting it inactive. Probably not the most elegant way but it is working now.
     
  32. Gionsec

    Gionsec

    Joined:
    Jul 28, 2020
    Posts:
    1
    Hello guys! I looked through all of the above solutions and still couldn't see my UI. After a lot of builds and runs, I finally hammered my way and thought to share this with you who are facing the same issue that I was. I for some reason deleted my camera during editing. Then when I created a new camera, I forgot to enable "Post Processing". Also, I made the following changes to the Panel element of UI-->
    #Created a Sprite(2D and UI) and dropped it in "Source Image"
    #Set material to "Sprites-Default"
    #Set "Image Type" to "Simple"
    # Enabled "Use Sprite Mesh".
    To mention, my unity version is 2020.1.0f1
     
  33. irshadgirachirshu

    irshadgirachirshu

    Joined:
    Sep 14, 2020
    Posts:
    7
    Many people have different answers for similar problems. Here's what I did to solve the problem of the UI disappearing.
    Delete the scenes that are not in use or will not be and created a new build path for the scene and it worked! Hope it does for you too.
     
  34. iam11yearsoldboiiiii

    iam11yearsoldboiiiii

    Joined:
    Mar 11, 2021
    Posts:
    7
    Ummm.... i have a very confused about my own situation
    Whenever i try and use unity and open the tab for getting some ui buttons but then the ui tab
    isnt there and then when i open a completed scene the ui i put on there was gone.
    After i saw this i kind of panicked so then i opened the non published game i found out
    that, for some reason, all of the ui that i previously put was there so now i all i can do is
    sit here and hope that someone will fix this( i have reinstalled unity ui and it seems as if it was fixed but its not idk why).
     
  35. donat_01

    donat_01

    Joined:
    Aug 1, 2020
    Posts:
    4
    en unity los anchors de un Rectransform son muy complejos de entender del todo. pueden jugar con ellos e intentar ajustarlos al centro o de diferentes maneras. en mi caso solo basto con ajustarlo al centro y volvió a aparecer el panel.
     
  36. wraex

    wraex

    Joined:
    Sep 23, 2016
    Posts:
    1
    Just to add one more possible solution...make sure your canvas is set to the right mode depending on your specific build and rendering camera('s). I remember something similar happening to me (UI showing in editor and gameview but not in build). Caused by canvas setting of screen space-camera as opposed to screen space overlay.
     
  37. fungfung1994

    fungfung1994

    Joined:
    Dec 4, 2018
    Posts:
    1
    It workssssss. amazing
     
  38. Nikhil_3020

    Nikhil_3020

    Joined:
    Oct 15, 2020
    Posts:
    2
    I guess i found that using post processing in main camera makesthe ui disappear ffrom the scene as when i unchecked it then it ran sucessfully
     
    MD_Reptile likes this.
  39. Firestorm200

    Firestorm200

    Joined:
    Sep 29, 2013
    Posts:
    5
    Just In case some one came here in the future the solution for my issue was that for some reason in
    Project Settings > Graphics i was missing many shaders inside (Always Included Shaders) include (UI/Default) & (UI/Default Font) Shaders
     
    Egoroneplus and JoeStrout like this.
  40. Ryowu

    Ryowu

    Joined:
    Apr 9, 2020
    Posts:
    1
    For me, I finally realized that my UI element's anchor is not set. After I set it to left-top anchor I see my image. Well, as you know the problem comes from the solution change. When you debug in unity, the solution is what you choose from the drop-down on the left side of your debug window. You can try to change it in run time and you will see some UI disappear if you didn't setup the anchor. I think this is the most happened issue among us.
     
  41. yayyyyyyyyyyyyy

    yayyyyyyyyyyyyy

    Joined:
    Feb 20, 2021
    Posts:
    1
    Had the same problem. I set the "UI Scale Mode" of the Canvas to "Scale WIth Screen Size" and replaced all the UI and now it is fixed.
     
  42. arielos

    arielos

    Joined:
    Sep 20, 2020
    Posts:
    1
    Tank you genius!!!
     
  43. King9999

    King9999

    Joined:
    Sep 21, 2017
    Posts:
    3
    Hey all, I encountered a similar problem that was described in this thread, except it was one specific piece of UI in my case.

    What worked for me was modifying the script execution order. Click Edit > Project Settings > Script Execution Order, then click the + button at the bottom to add your own scripts. Do not touch what is already there unless you know what you're doing. Try adding the script that has the UI you're troubleshooting. What may be happening is that the object that has the UI script doesn't exist by the time the game tries to execute the code. If you can figure out the problem through code, I would do that first before modifying the script execution.
     
    lupus0707 likes this.
  44. umterDev

    umterDev

    Joined:
    May 3, 2022
    Posts:
    1
    The text box was small for the text in the box. When I enlarged the text box a bit, the problem was solved.
     
  45. Elite_Champion

    Elite_Champion

    Joined:
    Jun 20, 2017
    Posts:
    1
    Im having this same issue with the updating after resizing, do you know any solutions
     
  46. calummulveen

    calummulveen

    Joined:
    Jul 15, 2020
    Posts:
    1
    HELLO ALL
    So this frustrated me for about an hour - I couldn't see ANY UI.
    What worked ? --- Ticking POST PROCESSING box in camera
    WHY? --- I will take a poorly educated guess and say it is because I was using the lighting system, and so post processing was required to render the images of the UI with those effects.
     
  47. koreyjarmon

    koreyjarmon

    Joined:
    Jun 6, 2014
    Posts:
    1
    this worked for me thanks!
     
  48. akumar27

    akumar27

    Joined:
    Aug 9, 2022
    Posts:
    1
    Was it called Post-process Layer?
     
  49. hussam_24

    hussam_24

    Joined:
    Nov 24, 2020
    Posts:
    1
    I had the same issue, just make sure the you add the camera to the (canvas render camera )
     
  50. caden-burleson

    caden-burleson

    Joined:
    Aug 1, 2011
    Posts:
    24
    I'm still dealing with this issue in Unity 2022.3.16f1 and Xcode15.1