Thursday, July 28, 2022
HomeGame Developmentcinemachine - Unity TextMeshPro UGUI textual content is about in Debug console...

cinemachine – Unity TextMeshPro UGUI textual content is about in Debug console however doesn’t present in display


I adopted Brackey’s tutorials: https://www.youtube.com/outcomes?search_query=brackeys+timeline

So I made an empty GO (recreation object), put Canvas, Picture and TMP (TexMeshPro) below it.
The picture fills the Canvas and is all black with alpha=1 at begin to 0 in 5 seconds.
The TMP’s textual content can also be animated to go from alpha = 1 to 0 in 3.5 seconds.

timeline

The third animation observe from the highest is the fades.
I even have a script that modifications the textual content on every fade-in to every “scene”.

utilizing System.Collections;
utilizing System.Collections.Generic;
utilizing UnityEngine;
utilizing TMPro;
utilizing System;  //entry date and time

public class FadeInTMPScript : MonoBehaviour
{
    public Animator anim;
    public TMP_Text currText;
    public TextMeshProUGUI m_Object;
    non-public string[] _fadeInStrs;
    non-public string _startStr = "A lethal virus has been unleashed by the hands of the evil Dictator X";
    non-public string _alienStr = "Defeat X's military of alien ninjas and accumulate the keys...";
    non-public string _chestStr = "The treatment is in a chest someplace within the metropolis...";
    non-public int _currIdx;
    void Begin()
    {
        _fadeInStrs = new string[] { _startStr, _alienStr, _chestStr };
        _currIdx = 0;
    }

    public void SetTMPText()
    {
        m_Object.textual content = _fadeInStrs[_currIdx];
        Debug.Log(m_Object.textual content);
    }
    public void IncrementIdx()
    {
        _currIdx++;
        Debug.Log("index" + _currIdx);
    }
   
}

This script is hooked up to the highest stage SceneChangeFader27 Recreation Object and the operate SetTmpText() known as at first of the FadeIn3 animation. Then I name IncrementIdx() on the finish of the FadeOut animation.
Thus I believed I might use an array and increment the index.

However once I throw in these blocks of FadeIn3 and FadeOut into the animation observe, all I get is a black display.

Additionally, with out the third animation observe the Timeline works, ie. transitions from one digital digicam to a different.

I expanded the easy check to go FadeIn3 -> motion -> FadeOut -> FadeIn3 -> motion -> FadeOut and the fades work however I solely get textual content within the first fadeIn3.

I’ve a key occasion to name SetTMPText() at the beginning of the fadeIn3 Animation nevertheless it’s solely being referred to as the primary time?
Really it is being referred to as and reveals in Debug.Log

debug

What am I doing flawed?
My assumption now could be that m_Object.textual content can solely be set as soon as however that appears flawed.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments