Search Unity

TextMesh Pro WarpTextExample.cs - enable / disable object causes script to stop working

Discussion in 'UGUI & TextMesh Pro' started by AndersKorodi, Feb 25, 2018.

  1. AndersKorodi

    AndersKorodi

    Joined:
    Sep 13, 2017
    Posts:
    2
    Im using Unity 2017.3 and TextMeshPro Release 1.0.56.xx.0b3 posted on feb 23, 2018 in this forum.

    Im having problem with the WarpTextExample.cs. When it is run the first time in the game, it works perfectly. The object containing the script and textmesh pro is disabled after it has been used and enabled next time it is needed.

    At this time the script will not activate. The textmeshpro text shows up like it should but no warp animation. This also goes for the "SkewTextExample". So might be a general problem for all the VertexAttributeModifier scripts.

    Is there a way to be able to enable and disable the objects and still get them to run the script each time they are enabled again?
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Those scripts are just provided to help demonstrate how you could modify the vertex attributes to achieve different visual FX. These should be used as a source for learning.

    In the case of the WarpTextExample.cs, it uses a Coroutine which is started in the Start() method. Since Start() is only called once, this Coroutine is not executed anymore when the object is enabled / disabled. So you will need to modify this logic to handle the enabling / disabling of the text object.
     
  3. AndersKorodi

    AndersKorodi

    Joined:
    Sep 13, 2017
    Posts:
    2
    Thank you so much for your response, Stephan.
    Moved it to a Void onEnable and Voila, works like a dream:)
     
    Stephan_B likes this.