I have an issue with moving around in a simple menu. I had a more complex project and pulled the broken parts into a very simplified base project so that the bug can clearly be seen. This means, all the menu game logic is stubbed out as print statements, so there should be no external dependencies on this bug repro-ing.
The issue is that the “get owning player” function for widgets returns an invalid reference to the player controller. One could get around this by simply getting the player controller for player 0. But that solution will not work for all use cases. When I was trying to repro it, a simpler UI did not repro the bug, so I worry it may be a race condition, but I don’t know/didn’t look deeper.
To repro with this project follow these steps
- Launch the menu map (should be default).
- Click the host button.
- Click the back button.
This should error out the UI and give a blank screen with an error message that reads: “LogScript: Warning: UGameplayStatics::SpawnObject null outer
LogScript: Warning: Accessed None trying to read property CallFunc_SpawnObject_ReturnValue
HostSessionMenu_C /Game/UEDPIE_0_Menu.Menu:PersistentLevel.PlayerController_0.HostSessionMenu_C_0
Function /Game/Blueprints/HostSessionMenu.HostSessionMenu_C:ExecuteUbergraph_HostSessionMenu:00D3”
Another repro method that works is:
- Launch the menu map (should be default).
- Click the join button.
- Click the back button.
- Click the join button again.
The join menu’s back button gets the player controller by player index instead of querying the widget owner which is why it works, but when we go back to the original menu, it’s buttons become broken because that menu uses “get owning player” (which means get owning player works at game launch for that menu and then breaks later on in the same run).
Project Dropbox link.
Public Github for project
If there is something I’m doing wrong with this menu creation please let me know, but I cannot find anything going on that makes sense for why this doesn’t work.