Are HUD refs in char causing an issue?

I was digging around because im trying to optimize for older devices and found this comment:

Are references to HUD in the character (and vice versa) a performance killer? I don’t “cast to” as the post says, but i definitely am not using game state (or instance) for anything related to updates with HUD. I store all of my player vars in the character, then i reference the HUD to update them. i.e. health, exp, magic, currency, etc is all stored in the character. Would this have a real impact on performance? I am seeing less than 20 fps in test builds and I’ve optimized the hell out of things. Grasping at straws now. Its going to be a big project to shift all this around so i thought i would seek wisdom first.

That seems very unlikely. It’s much more likely that this developer had some other problem that was (accidentally?) fixed at the same time.
Maybe they didn’t even have a HUD on the character, and were getting error messages every frame? Who knows?

If you’re having a problem, use the profiler to figure out where the problem is.

1 Like

My profiler is heavy on the game thread:

I dont understand why it is 84ms on frame tine at the top, but when i drill down to individual elements, it does not ad up to84sm (or even close).

I should also note that tick is disabled in all of the blueprints individually and globally in project settings, so i have no idea what could be happening with tick at all. I have it enabled in HUD because i need it for animations that occur in HUD. But it doesn’t appear like that is the problem in profiler. Big mystery to me.

The game thread synchronizes with the render thread.
If your render thread is running slowly (12 fps?) then the game thread won’t run any faster.
Is this profile taken from a release mode build or a debug mode build?
Is it taken from “play in editor” or a built binary?
How big is the playing window? If you make the playing window much smaller, will it spend less time in frametime? (this is a good quick way to test if you’re fill rate / shading limited.)

This one in particular is PIE, but it looks exactly the same in the packaged build. This is a mobile dev so the screen size is smaller i would assume. I am not sure if that means anything compared to a PC build. What would be you top considerations to help the render thread?

Typically there’s more than one render thread (at least on higher-end targets like D3D12 – don’t know exactly about the mobile renderer.)

The concerns on rendering performance are the standard ones: Shader complexity, overdraw, geometry complexity, size/mipmaps of textures, and so on.
If you’re doing a lot of physical simulation or some other heavy subsystem, that could cause longer frame times, too.