Download

Work with UMG (dynamically changed) while game paused

Unreal Engine 4.9.1

Hello!

I have such problem:

My menu is builded with component cubes and component widgets. All of this is inside One Actor (C++ -> Blueprint).
Every button have widgets component with field of own ‘Widget Class’. Every widgets class is made manually (Widget Blueprint or C++ -> Widget Blueprint).

My menu should work when game paused. Now my menu work well without game paused. So I start upgrade my menu to work while game is paused.

  1. I change every timer function (which dont work while paused) to my own function with core inside actor whose ‘Tick Even when Paused’ is set to TRUE. Work well.

  2. UMG classes set as ‘widget class’ of component widgets don’t update content while game is paused.
    This link UMG Pause - UE4 AnswerHub inform that I can go around this problem, construct UMG widgets AFTER I set game paused.

I cannot destroy and create full actor because of light should be burned.
So now I’m trying to create widget component of actor:
a) I cant do this inside c++:
Dam = CreateDefaultSubobject<UWidgetComponent> (TEXT (“Dam22”));
Dam->SetOnlyOwnerSee (true);
Dam->RelativeLocation = FVector (220.0f, -50.0f, 0.0f);
Dam->RelativeRotation = FRotator (40.0f, 0.0f, 90.0f);

Ham = CreateDefaultSubobject&lt;UWidgetComponent&gt; (TEXT ("Ham22"));
Ham-&gt;SetOnlyOwnerSee (true);
Ham-&gt;AttachParent = Dam;
Ham-&gt;RelativeLocation = FVector (220.0f, -50.0f, 0.0f);
Ham-&gt;RelativeRotation = FRotator (40.0f, 0.0f, 90.0f);
Ham-&gt;SetWidgetClass (UTheMenuRightImages::StaticClass()); 

I see this widgets inside unreal editor, but function CreateDefaultSubobject work ONLY in constructor. So I cannot make this way widget in controlled way every time after I set game pause.

b) Another possibility is to create widget component of specified class inside blueprint. So I’m trying to do that, but without any effect. I’m trying to create widget component inside menu actor blueprint.
“Add Widget Component” in space screen (which I dont wont) is create while game paused well. When I change parameter space to world, I see nothing when creating while game paused. I test it also not while paused - and the same node “Add Widget Component” in space world create widget well. Example class of this widget component is TestUI which only have Image widget with static brush.

c) Maybe widget created dynamically after set game paused to true can be done inside UMG. So then I create in blueprint by “Add Widget Component” and then “Add to Viewport” Panel’s and Images UMG, but without any success. Widgets created after set game paused to TRUE, don’t work - I don’t see anything.

What is the possibility to work with (change dynamically content) UMG while game is paused ???