Customise Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorised as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

No cookies to display.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

No cookies to display.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

No cookies to display.

Performance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.

No cookies to display.

[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.

TextMeshPro text

TextMeshPro component

No sprite fade-in

[ad_2]

Leave a Reply

Your email address will not be published. Required fields are marked *