[Crash] Creating UMG Widget in Player Controller

Not sure why or if it’s intended.

Creating a widget in PlayerController with a ‘self’ plugged in crashes with these: ( it doesn’t even need to plug anything to the output pin )

!Id:ea4253df2fefb57712c7100a0832c835

Unknown exception - code 00000001 (first/second chance not available)

Cast of NULL to LocalPlayer failed

KERNELBASE + 37901 bytes
UE4Editor_Core + 3095148 bytes
UE4Editor_Core + 1661722 bytes
UE4Editor_CoreUObject + 357979 bytes
UE4Editor_Engine + 3201930 bytes
UE4Editor_Engine + 4982031 bytes
UE4Editor_UMG + 56349 bytes
UE4Editor_UMG + 327336 bytes
UE4Editor_UMG + 910410 bytes
UE4Editor_CoreUObject + 547972 bytes
UE4Editor_CoreUObject + 1302075 bytes
UE4Editor_CoreUObject + 1411042 bytes
UE4Editor_CoreUObject + 1537024 bytes
UE4Editor_CoreUObject + 1416047 bytes
UE4Editor_CoreUObject + 1303464 bytes
UE4Editor_CoreUObject + 1416047 bytes
UE4Editor_CoreUObject + 547972 bytes
UE4Editor_CoreUObject + 1414048 bytes
UE4Editor_Engine + 1749361 bytes
UE4Editor_Engine + 1737161 bytes
UE4Editor_Engine + 1745468 bytes
UE4Editor_Engine + 4870297 bytes
UE4Editor_Engine + 3672349 bytes
UE4Editor_Engine + 3605420 bytes
UE4Editor_Engine + 4871473 bytes
UE4Editor_Engine + 9457430 bytes
UE4Editor_Engine + 3091031 bytes
UE4Editor_Engine + 3097951 bytes
UE4Editor_Engine + 3096845 bytes
UE4Editor_Engine + 3097494 bytes
UE4Editor_Engine + 5733901 bytes
UE4Editor_Engine + 5735125 bytes
UE4Editor_OnlineSubsystemUtils + 453158 bytes
UE4Editor_Engine + 5576327 bytes
UE4Editor_Engine + 823427 bytes
UE4Editor_Engine + 5388970 bytes
UE4Editor_UnrealEd + 1814406 bytes
UE4Editor_UnrealEd + 5925286 bytes
UE4Editor!FEngineLoop::Tick() + 3294 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.4\engine\source\runtime\launch\private\launchengineloop.cpp:2098]
UE4Editor!GuardedMain() + 476 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.4\engine\source\runtime\launch\private\launch.cpp:133]
UE4Editor!GuardedMainWrapper() + 26 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.4\engine\source\runtime\launch\private\windows\launchwindows.cpp:125]
UE4Editor!WinMain() + 249 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.4\engine\source\runtime\launch\private\windows\launchwindows.cpp:201]
UE4Editor!__tmainCRTStartup() + 329 bytes [f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c:618]

][1]

Hi ,

Can you post your crash logs here so we can have a look? Does this occur on a blank project with no additional content. Further, does this occur when you use a “Get Player Controller” in the “Owning Player” slot? Thank you!

I just checked and re-tested. this is fully reproducible. BUT I missed out one very critical part , it only crash on multiplayer if you put more than 1 client. (hence the LOCAL Player crash message _
Follow these steps, if you’re unable to reproduce this , i’ve attached this as well.

  1. Create empty widget
  2. Create player controller setup as above.
  3. Launch game with more than 1 client.

GetPlayerController does not work as it is already a player controller blueprint. link text

Hi ,

I was able to reproduce this on my end and have entered in a bug report, TTP#345578 to be assessed by our development staff. Thank you and have a great day!

Has there been any progress on this? Or has anyone found a workaround for the time being?

This is still under assessment by the development staff. I do not have a timeframe of when it will be addressed.

In your first image, leaving the reference blank (without a pin) will assign the default controller. (This is normally player index 0) however, referencing self is pulling a NULL value, because no value is assigned to self. In order to use a reference, use “Get Player Controller” with a default value of 0 for the player index. This is identical to leaving the reference blank - as you did in the first image.

I should add that although this is in the player controller blueprint, self will report null because the index isn’t generated yet. If there was a “get player controller” and the index was “Self” then it would work. But alas, there is not.

I don’t think “Self” should be NULL. already put it in the bug report. “Self” could/should give the controller of the player using it i guess.

I have found a way around this. For some reason it doesn’t find a controller immediately when pressing play. If you have a game mode tell the controller to create its HUD on PostLogin with a slight delay ~0.1 seconds it works just fine.

I had this issue (or very similar) and I think that this is because you have a bad setup, on a replicated game you cant call this on that way, why? because if you call the “create widget” event on every actor of the replication world (because one actor is beign “duplicated” on all clients) you cant access its controller, cause the controller its a non replicated entity.

so, what you have to do is this:

http://img.prntscr.com/img?url=http://i.imgur.com/ZkNUonQ.png

You have to call the event ONLY on the server (just place a “has authority” node before the event call) and then make your custom event to be replicated “on owning client only”

Also you have to make sure that this is beign called after the begin play event, if not you can get a null from the get controller

Resuming, its true that is a bug because it crashes the editor, but if you do it as intended it will work without problems over the network

EDITED: I forgot to mention that the reason because it works if you dont assign any “owning player” pin is because by default the create widget node creates it on all player controllers in the world, so it wont try to access to a non existing controller

EDIT 2: Here you will find a detailed explanation on how replicate on owning client works: Replicating Functions in Blueprints | Unreal Engine Documentation

Which blueprint do these nodes have to be in?