Search Unity

Resolved WebGL build doesn't display Text objects

Discussion in 'Editor & General Support' started by elfqwerty, May 7, 2022.

  1. elfqwerty

    elfqwerty

    Joined:
    Feb 25, 2022
    Posts:
    2
    -----
    *Edit*
    I've noticed that the old "Text" became "Text (Legacy)" in my current Unity version (2021.3.1f1 LTS). So I've switched to TextMeshPro and now the text objects appears in the WebGL build. It seems that, in this version, Unity doesn't support the legacy Text object for WebGL build. I've tried many tweaks in the Canvas configuration, changed the resolution in Player settings, and even used the "Best fit" option of Text, but it just doesn't work. So the solution now is to use TextMeshPro.
    -----

    I've created a fresh Unity 3D game project, and created a scene with UI objects only (Canvas with Text, InputField and Button).

    Screenshot from 2022-05-07 18-55-45.png

    It works fine running the game inside the Editor, as you can see in the image above. But when I build for WebGL, the Text objects simply won't appear. The errors in the console don't crash the game, and I don't think they're related to this issue (I've searched the internet for a solution, but unfortunately, there isn't).

    Screenshot from 2022-05-07 18-03-23.png

    If you want to test the project, here is the github repository.

    I'm using the following stack:

    Unity version: 2021.3.1f1 LTS
    Build platform: WebGL
    OS: Ubuntu 20.04
     
    Last edited: May 8, 2022
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,745
    Thanks a lot for coming back to post.

    This seems unlikely, or it really is a legitimate bug.

    Have you been able to replicate the issue with an empty project and Text built to WebGL?

    You can also look in the browser console to see if there are any obvious exceptions thrown, like "can't find font" or whatever.
     
  3. danzokulov

    danzokulov

    Joined:
    Oct 1, 2022
    Posts:
    22
    Hello eweryone! Sorry for my English, it isnt my classic language. I have my own site where i developing my minecraft clone. And i have a problem: i have inputfield(legasy) and button which have a method from script in OnClick, and it isnt working! Help please! On screenshot there are buttons, top of they is that button which not working
     

    Attached Files:

    Last edited: Dec 6, 2022