Unity: Unable to clear the TMPro text animated using DoTween

676 views Asked by At

I have a TMPro text object in Unity as shown below: enter image description here

During the game level, I add texts which to this object which are animated using the DOText from DOTween, e.g. pickUpTextObj.DOText(pickUptext, 2f, true).SetRelative(true);

Once the levels is cleared and the new level is loaded, I need to clear this text field. I have tried all the three options as shown below in comment, but none of them is working. The text doesn't clear off and is stubborn. The text is attached to a DontDestroyOnLoad gameobject, and persists across levels.

pickUpTextObj = GameObject.Find("pickUpTexts").GetComponent<TextMeshProUGUI>();
//pickUpTextObj.DOText("\n", 0f, true).SetRelative(false);
//pickUpTextObj.DOText("", 0f, true).SetRelative(false);
//pickUpTextObj.text = "";
0

There are 0 answers