I have two blueprints BP_Elevator and BP_Player. BP_Player has a WidgetComponent attached.
On the elevator’s BeginPlay I get a reference to the player and therefore can get access to the player’s WidgetComponent. However, when trying to access the component’s widget itself using GetUserWidgetObject, I do not receive a valid reference.
When I use a delay of 2 seconds before accessing it, I do receive a valid reference.
Is this behaviour correct? I thought components were initialized before BeginPlay is executed. Since this is a problem that occurred after updating the project to 4.23, I am not sure if this behaviour is normal or if the project somehow got corrupted or something.
I just checked the source code of UWidgetComponent. InitWidget() is called in BeginPlay(). I did not expect that, but this explains what is happening. Weird.
I figured component intialization included initializing the widget as well. Does not seem so. Bummer.
I can go pretty low. Using a delay with 0.000001 still works.