CommonUI Plugin - UCommonBoundActionBar Not constructed during game pause

Hello,
I’ve found out that the actionbar widget (a UWidget component from Epic’s CommonUI Plugin) will not spawn if I pause the game.
Further investigation reveals that the plugin is using

GameInstance->GetTimerManager().SetTimerForNextTick(FTimerDelegate::CreateUObject(this, &UCommonBoundActionBar::HandleDeferredDisplayUpdate));

to create actionbar, this becomes a problem because the timer will not fire during game pause, and the action bar will not get constructed.
Is there any way to work around this issue?

2 Likes

I have run into the same issue. Very frustrating and surprising considering button bars are most commonly used on menu screens.

Hey guys. I have also ran into this unfortunate problem. I believe this issue exists because CommonUI is originally made for Fortnite, which is an online game, which was never meant to be paused, so this bug just slipped away.

I don’t think you can workaround this without modifying plugin’s code. In my case, I moved this call from next-tick timer to world’s tick start, which is functionally a very similar thing, just a little more code than that.

If anyone is interested in how exactly to make this work during pause, here’s what I did:

  1. We are going to modify following two files:
  • Engine\Plugins\Experimental\CommonUI\Source\CommonUI\Private\Input\CommonBoundActionBar.h
  • Engine\Plugins\Experimental\CommonUI\Source\CommonUI\Private\Input\CommonBoundActionBar.cpp
  1. Add this to header file’s private section:
void OnDisplayRefreshRequested(UWorld* World, ELevelTick TickType, float DeltaSeconds);

FDelegateHandle RefreshHandle;
  1. Add this function to .cpp file:
void UCommonBoundActionBar::OnDisplayRefreshRequested(UWorld* World, ELevelTick TickType, float DeltaSeconds)
{
	FWorldDelegates::OnWorldTickStart.Remove(RefreshHandle);
	HandleDeferredDisplayUpdate();
}
  1. Remove this timer creation in .cpp
GameInstance->GetTimerManager().SetTimerForNextTick(FTimerDelegate::CreateUObject(this, &UCommonBoundActionBar::HandleDeferredDisplayUpdate));
  1. And add this worldtick-based call instead
RefreshHandle = FWorldDelegates::OnWorldTickStart.AddUObject(this, &UCommonBoundActionBar::OnDisplayRefreshRequested);
  1. Compile and run. Now action bar should properly get constructed even when game is paused.
1 Like

Hi there @rit, hope you’re well!

This topic has been moved from International to Pipeline & Plugins.

When posting, please review the categories to ensure your topic is posted in the most relevant space.

Thanks and happy developing! :slight_smile:

Oh, one more thing, I’ve noticed that this is fixed in some later engine version. So you can ignore my previous message and use Epic’s solution:
https://github.com/EpicGames/UnrealEngine/commit/539f1aa73b5cbfe84c06e4c68a5d7a6726645f93

1 Like

Hello,
Thank you for providing solutions and updates regarding the issue.
I’m using the official pre-compiled UE5, I’ll give it a try once I upgrade to the latest version!
Thank you!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.