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 Make vertex adjustments permanent

Discussion in 'UGUI & TextMesh Pro' started by uwdlg, Jun 18, 2022.

  1. uwdlg

    uwdlg

    Joined:
    Jan 16, 2017
    Posts:
    115
    Hi,

    based on the "WarpTextExample" script from the TMP examples I wrote a script to position the letters of a TMP_Text on a curve. I would now like to have these mesh adjustments persist in the editor and in play mode, ideally without recalculating the positions frequently. The text doesn't change or move at runtime, is there some way to prevent the mesh from being rebuilt at runtime? If not, when should I call the method to adjust the vertices?
    Thanks!
     
  2. uwdlg

    uwdlg

    Joined:
    Jan 16, 2017
    Posts:
    115
    For anyone in my shoes, I experimented with this and figured out calling the mesh adjustment method in the following cases seems to be the necessary minimum:
    • in
      OnValidate()
      within
      if (!Application.running) {}
      for the editor preview
    • in a listener of the text component's
      OnPreRenderText
      callback for playtime
    Hope that helps some future reader