Repository navigation
UnitSource OnGUI FPS improvements - #118
Merged
Merged
Conversation
Only affects editor, but roughly 2x speedup when running from play window: - editor displays warning if a UnitSource is outside map - text showing this warning used a scrollview per BP - UnitSource OnGUI BeginScrollView is called for every event update and eventually called IsMouseOverGUIView, completely eviscerating performance (27ms/frame in my deep profile) Two very small changes: - Switched this warning to only repaint if repaint request happens (not if e.g. a click occurs) - Switched the ScrollView to BeginGroup to completely avoid mouse checks
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
enzomoret2511-glitch
approved these changes
Oct 9, 2026
|
Good find! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Only affects the editor, but roughly 2x FPS improvement when running from play window on my machine:
BeginScrollViewis called for every event update and eventually called IsMouseOverGUIView, completely eviscerating my computer (27ms/frame in my deep profile)Two very small changes:
For reference, the warning text:
Stats
(disclaimer: benchmarked on macOS. There's a nonzero chance of this being something strange with macOS mouse latency)
Benchmarked on X1CA_001:
master:After changes it's fairly negligible:
ongui-speedup:Arguably this warning could be ripped out entirely as I don't see it being particularly useful (and there are many campaign usecases of out of bounds objects), but this at least makes it not a performance problem.
BeginGroup reference docs: https://docs.unity.com/en-us/engine/6000.5/script-reference/unityengine/gui/begingroup