Search Unity

  1. Check out the Unite LA keynote for updates on the Visual Effect Editor, the FPS Sample, ECS, Unity for Film and more! Watch it now!
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

TextMesh Pro Modifying glow power on a material preset

Discussion in 'Unity UI & TextMesh Pro' started by dodderz, Sep 9, 2018.

  1. dodderz

    dodderz

    Joined:
    Apr 20, 2015
    Posts:
    6
    I have a TextMeshProUGUI and within the text one word is being set to use a different material preset using the <font="" material=""> tag. The replacement material preset has glow enabled. This works fine but I then want to modify the glow power of that material. I tried doing this by modifying the glow power on the material of the sub mesh that gets created for that text but this doesn't seem to do anything (I imagine the value is getting overwritten by textmesh pro itself each frame?)

    What's the correct way to do this? I want to increase the glow over time. Note that the <font> tag is being inserted at runtime if that makes any difference
     
  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    1,782
    When accessing materials, you have to be mindful that accessing the material directly will result in an instance of a material being created (this is a long established Unity convention) whereas accessing the shared material will affect the material that might be shared by several objects.

    So in this case, it is possible that you end up modifying an instance instead of the shared material.