Skip to content

UnitSource OnGUI FPS improvements - #118

Merged
BlackYps merged 1 commit into
FAForever:masterfrom
UZ9:ongui-speedup
Oct 11, 2026
Merged

BlackYps merged 1 commit into
FAForever:masterfrom
UZ9:ongui-speedup

Conversation

@UZ9

@UZ9 UZ9 commented Oct 7, 2026 •

Copy link
Copy Markdown

Overview

Only affects the editor, but roughly 2x FPS improvement when running from play window on my machine:

  • editor displays warning if a UnitSource is outside map
  • text showing this warning used a scrollview per BP
  • During UnitSource's OnGUI BeginScrollView is called for every event update and eventually called IsMouseOverGUIView, completely eviscerating my computer (27ms/frame in my deep profile)

Two very small changes:

  • Switched this warning to only repaint if a repaint request happens (not if e.g. a click occurs)
  • Switched the ScrollView to BeginGroup to completely avoid mouse checks

For reference, the warning text:

image

Stats

(disclaimer: benchmarked on macOS. There's a nonzero chance of this being something strange with macOS mouse latency)

Benchmarked on X1CA_001:

master:

image

After changes it's fairly negligible:

ongui-speedup:

image

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

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
@coderabbitai

coderabbitai Bot commented Oct 7, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: adc70dcf-d077-41ba-ae7c-ef0abe0f6da6
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@BlackYps

Copy link
Copy Markdown

Good find!

@BlackYps
BlackYps merged commit 4723aa3 into FAForever:master Oct 11, 2026
1 of 3 checks passed
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

Successfully merging this pull request may close these issues.

3 participants