[ad_1]
public IEnumerator FadeTextmeshproIn(float t, TextMeshProUGUI textual content)
{
textual content.coloration = new Shade(textual content.coloration.r, textual content.coloration.g, textual content.coloration.b, 0);
TMP_SpriteAsset spriteAsset = textual content.spriteAsset;
spriteAsset.materials.coloration = new Shade(spriteAsset.materials.coloration.r, spriteAsset.materials.coloration.g, spriteAsset.materials.coloration.b, 0);
whereas (textual content.coloration.a < 1.0f)
{
textual content.coloration = new Shade(textual content.coloration.r, textual content.coloration.g, textual content.coloration.b, textual content.coloration.a + (Time.deltaTime / t));
spriteAsset.materials.coloration = new Shade(spriteAsset.materials.coloration.r, spriteAsset.materials.coloration.g, spriteAsset.materials.coloration.b, spriteAsset.materials.coloration.a + (Time.deltaTime / t));
yield return null;
}
}
It is a operate I’m utilizing to fade-in a TextMeshPro element. The TextMeshPro consists of a sprite and a textual content, as proven within the pictures beneath.
Nevertheless, when the operate is named, solely the textual content fades in, and the sprite by no means seems, as proven within the gif beneath. I can not seem to discover a strategy to make them each fade in collectively.
Additionally be aware that I wish to maintain them in the identical element, as a result of splitting them up into two elements would make it arduous to maintain the spacing between them the identical because the rating subsequent to it will get greater.
[ad_2]