Search Unity

TextMesh Pro GUI- Surface shader lighting

Discussion in 'UGUI & TextMesh Pro' started by Antragon, Dec 7, 2018.

  1. Antragon

    Antragon

    Joined:
    Jun 9, 2015
    Posts:
    4
    Hey there,

    I'm currently trying to figure out how to get lighting to work in game view on Textmesh Pro GUI.

    Basically what I do is:
    - open new Unity project (tried with Unity 2018.2.15f1 as well as Unity 5.6.1p1)
    - Add Gameobect > UI > TextMeshPro - Text
    - Set Shader to TextMeshPro/Distance Field (Surface)
    - Add Gameobject > Light - Directional Light

    and what I get is this:

    upload_2018-12-7_5-28-20.png

    Clearly the game view looks different from the scene view. I know I could use a TextMeshPro 3D Gameobject, but given that lighting affects the GUI correctly in the scene view, is there any other way to resolve this issue without 3D objects?

    Thanks!
     
    Last edited: Dec 7, 2018
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The Canvas must be in either Screen Space Camera or WorldSpace. Make sure you assign a Camera to the Canvas.

    For better visuals, use a Point Light or Spot Light.
     
  3. Antragon

    Antragon

    Joined:
    Jun 9, 2015
    Posts:
    4
    Thanks a lot, that did the trick!
     
    Stephan_B likes this.