Hi! I am currently working on a project and ran into a problem that regards a function I need throughout the game. I was looking for a sort of GUI Text that pops up throughout the game, mostly for dialogue or natural message purposes (In game screenshot below)
(Basically the text that fades in and out when the protagonist speaks as well as the messages that guide the player on what to do or where to go) Many thanks
This is very simple all you have to do is add the canvas group component to the text, then you will add the ANIMATION (Not animator unless you want to) component to the object, then create an animation and change the alpha to zero or what ever number you want at about 2 seconds in or however long you want it to fade for. You can then create a script like this and put it on the gameObject.
โFor c# just change function to voidโ
function OnTriggerEnter ()
{
gameObject.GetComponent.<Animation>().Play("name of animation");
}
This is actually very simple! Just make a canvas group, get a local reference to it (using UnityEngine.UI, public CanvasGroup cg, maybe cg = GetComponent< CanvasGroup>()), and SmoothDamp the alpha of the CanvasGroup (cg.alpha = Mathf.Smoothdamp(cg.alpha, 1 to fade in/0 to fade out, ref referenceVariable, fadeTime)