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

Bad performance after changing lang in runtime on a Linux machine. #110

Open
Barina opened this issue Jul 8, 2023 · 2 comments
Open

Bad performance after changing lang in runtime on a Linux machine. #110

Barina opened this issue Jul 8, 2023 · 2 comments

Comments

@Barina
Copy link

Barina commented Jul 8, 2023

What is Happening:
Everything works great with the default language English. FPS starts to plummet when changing the language to Hebrew (RTL) using Unity's slider.
Now whenever the user interacts with any RTLTextMeshProUGUI (without changing the text), UI stutters.
It looks like the canvas is being rebuilt for no reason..

What is Expected:
Text is being rebuilt only once and scripts should be optimized at least a bit.

Extra Details:
Consider the profiler screenshot below:
image

  1. (green) is where current language is the default - English.
  2. (red) is where the user changed to Hebrew (RTL).
  3. (yellow) is 4 interactions with 2 RTLTextMeshProUGUI components. that means simply selecting them back and forth using the arrow keys.
  4. (pink) is what eating the FPS.

Needless to say this is a potato machine with AMD APU so performance is important.
If needed I'll upload the data to my drive.

I hope this repo is still being maintained. it's been > a year after last commit.

@hk1ll3r
Copy link
Collaborator

hk1ll3r commented Jul 16, 2023

Thanks for reporting this Barina. Do your text boxes contain a lot of text? The fixer algorithm can be optimized but it would be rather cumbersome and we don't have too much time for this project. And we haven't had more reports of perf issues.

As a workaround you may be able to set the language once after the user presses confirm or something similar.

@Barina
Copy link
Author

Barina commented Jul 24, 2023

Hi @hk1ll3r thanks for the reply
Yea I figured you don't have much time for this project unfortunately..
So I did investigate further and looks like when changing the color (alpha in my case) of the TMP text, it gets rebuilt which I'm guessing is fine! (it raises the havePropertiesChanged flag)
But, iterating over the text is unnecessary when we explicitly know that it didn't changed.
Maybe it's a simple fix :) in RTLTextMeshPro.cs file, we can add a new string to hold "fixed text" and only update the base text when it doesn't match the fixed one.. or maybe we can add new flag haveTextChanged.

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

2 participants