Skip to content

Performance Enhancement: GameObject Culling#2789

Open
Vwing wants to merge 1 commit into
Interkarma:masterfrom
Vwing:culled-gameobjects
Open

Performance Enhancement: GameObject Culling#2789
Vwing wants to merge 1 commit into
Interkarma:masterfrom
Vwing:culled-gameobjects

Conversation

@Vwing
Copy link
Copy Markdown

@Vwing Vwing commented May 24, 2026

Performance Enhancement: GameObject Culling

This feature has been part of the Android fork for the past couple years. It greatly improves performance on mobile, and the performance gains are pretty great on desktop as well.

On my machine in the Wayrest dungeon with culling disabled, Profiler shows constant stuttering to 30fps and an occasional 15fps lag spike. With culling enabled, it stays closer to 60fps, occasionally spiking to 30fps. The remaining lag is due to AutoMapper, which is optimized in Android and I'd like to open a separate PR for that.

How it works

The CulledGameObjectManager disables Billboards, Foe Spawners, Enemies, Action Doors, Static NPCs, Loot, and Dungeon Blocks that are further than 2060 unscaled units away from the player. It does so by moving them under a disabled game object parent, so that their local enabled/disabled state is unchanged.

It culls these object types on separate frames, which helps smooth out any lag from enabling and disabling a ton of GameObjects all at once.

Implementation Notes

  • added relevant 'Object Culling' setting to Video settings (defaulted to enabled)
  • ActiveGameObjectDatabase now supports inactive object lookups (required for culling disabled objects, otherwise you can have e.g. enemies walking around in disabled dungeon blocks)
  • billboards are now registered with the ActiveGameObjectDatabase (so they may also be culled; we only bother doing so when the player is outside)
  • added CulledGameObjectManager to the game scene

* added relevant 'Object Culling' setting to Video settings (defaulted to enabled)
* ActiveGameObjectDatabase now supports inactive object lookups (required for non-buggy culling)
* billboards are now registered with the ActiveGameObjectDatabase (so they may also be culled)
* added CulledGameObjectManager to the DaggerfallUnityGame.unity scene
@KABoissonneault
Copy link
Copy Markdown
Collaborator

Thank you for sharing your improvements back to the main repo.

I admit at this stage, I'm a bit hesitant to add a new bunch of unknowns into the build, but this is also more in Daneel's hands, so that's his call whether he wants to add a new round of testing with your latest PRs.

I'm aware these have been played on Android for a long time, but it was also on another Unity version, and I'm not sure I can trust Unity to not have weird inconsistencies in runtime behavior between even minor versions.

Again, leaving this to Daneel.

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.

2 participants