Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

TextMesh Pro TMP SpriteAsset with custom material instantiation at runtime not working?

Discussion in 'UGUI & TextMesh Pro' started by Yandalf, Sep 3, 2022.

  1. Yandalf


    Feb 11, 2014

    I'm creating a system where I'm spawning TMP elements (non-gui) at runtime and set them up with a few settings. The result should be a TMP element displaying a sprite from a given SpriteAsset using a material set in that SpriteAsset. This works fine when using the default TMP Sprite shader for this material, but when I try this with a material using TextMeshPro/Mobile/Distance Field the resulting element is a transparent full quad. If I then edit the text in the TMP element, the sprite will show up correctly.
    Any idea how I could make sure the sprite will be correct immediately after spawning? I already tried using ForceMeshUpdate, but this had no visual effect.