Thursday, July 28, 2022
HomeGame DevelopmentFade-in Fade-out Reduce Scenes With Cinemachine and Timeline Unity exhibiting only a...

Fade-in Fade-out Reduce Scenes With Cinemachine and Timeline Unity exhibiting only a black display screen


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

So I made an empty GO (sport object), put Canvas, Picture and TMP (TexMeshPro) underneath 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 adjustments 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 string testText;
    public TextMeshProUGUI m_Object;
    personal string[] _fadeInStrs;
    personal string _startStr = "A lethal virus has been unleashed by the hands of the evil Dictator X";
    personal string _alienStr = "Defeat X's military of alien ninjas and accumulate the keys...";
    personal string _chestStr = "The treatment is in a chest someplace within the metropolis...";
    personal int _currIdx;
    void Begin()
    {
        _fadeInStrs = new string[] { _startStr, _alienStr, _chestStr };
        _currIdx = 1;
    }

    public void SetTMPText()
    {
        m_Object.textual content = _fadeInStrs[_currIdx];
        _currIdx++;

    }
   
}

This script is hooked up to the highest degree SceneChangeFader27 Sport Object and the perform SetTmpText() is named in the beginning of the FadeIn3 animation.
Thus I assumed I may use an array and increment the index.

It really works for one string in a easy take a look at.

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

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

I expanded the straightforward take a look at 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() firstly of the fadeIn3 Animation however it’s solely being referred to as the primary time?

What am I doing unsuitable?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments