Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question How to use SRP Batcher (or GPU Instancing) in Text Mesh Pro

Discussion in 'UGUI & TextMesh Pro' started by amenonegames, Oct 4, 2023.

  1. amenonegames

    amenonegames

    Joined:
    Nov 10, 2021
    Posts:
    19
    I modified the TextMeshProUGUI property to make the SRP Batcher Compatible.
    However, when I put multiple text meshes on the screen and examine them in FrameDebugger, I see that they are not batching and separate Batchers are created.

    Also, there is a description in TMP_SDF.shader that makes me think GPU Instancing is supported, such as UNITY_VERTEX_INPUT_INSTANCE_ID,
    In fact, it seems to be incomplete.
    (Not surprising because the Canvas Renderer does not support Property Block.)

    Whatever the case, I would like to draw multiple TextMeshProUGUI batching.
    Is there a good way to do this?

    *I also tried enabling dynamic batching, but it didn't work.

    *For other production reasons, I am updating the vertex, color, uv3 of the TextMesh every frame.
    upload_2023-10-5_4-23-35.png

    upload_2023-10-5_4-30-20.png
     
  2. amenonegames

    amenonegames

    Joined:
    Nov 10, 2021
    Posts:
    19
    It seems like the font material was instanced per component because script changed material property.
    It desabled GPU instancing.

    I deleted material change method, so material become same within all textmeshpro component.
    It reduce batch call. Thank you!