Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility with changing text color/color gradient at runtime #3

Closed
vcesario opened this issue Aug 9, 2019 · 2 comments
Closed

Comments

@vcesario
Copy link

vcesario commented Aug 9, 2019

Calling DOFade() for the second time after changing a TMP_Text's color properties (be it color or vertexGradient) will reset it to its former solid color. Is this a known behavior that needs to be locally adressed or I'm just missing something?

@zephyo
Copy link

zephyo commented Sep 9, 2020

Figured it out.

In CharTweener.cs CreateProxyColor, change to:

            var color = new CharColor
            {
                VertexGradient = Text.colorGradient,
                Color = Text.color,
            };

Previously:

            var color = new CharColor
            {
                Color = Text.color,
                VertexGradient = Text.colorGradient
            };

The order matters, because when we set Color, we really call SetColor(), which doesn't do anything if VertexGradient isn't set first.

@alexpdaniel
Copy link

Thanks for that Zephyo. In my first use of this library I didn't have this issue, then on the next my text would flash back to the originally set color before doing the tween. Your solution fixed that issue for me, so thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants