Using actor object ref as a public variable on widget crashes packaged game

Hi there

I have managed to replicate this on an empty project.

I create an empty actor blueprint, then create a simple widget with a single button. Within the widget blueprint I added an exposed variable of type ‘actor object ref’ and then simple set up an onclicked event to print the actor label of this variable.

Once that is done I drag a single actor blueprint into the scene to have an actor to find.

On the level blueprint I use a ‘get all actors of class’ and create my widget and add to viewport. I then plug a single result of the ‘get all actors’ into the exposed variable of the widget, save all and run.

In editor this works fine. The actor in the level is found using the level BP search, and then printed to screen when I hit the button, however if I package this and press the same widget button I get a ‘fatal error’ crash.

I currently have a workaround in my head that I think will work fine but it involves passing a unique ‘actorID’ through to the widget and then searching all actors, cross-referencing the I’d to find out which actor to work with, as u can image it’s not as efficient as simply getting the actor ref as I have tried.

Am I doing something wrong, is it a bug, or simply a limitation of the engine?

Thanks for any help

OK I think I got to the bottom of this. The problem is nothing to do with the actor ref it is simply to do with the fact when you drag from an actor to a print node it creates a display name conversion node by default. After doing some more investigations yesterday I came across someone saying that the display name is for editor use only and cannot be accessed once the game is packaged. This may explain why it was crashing.

As a work around I added a ‘name’ variable as a string to my actor bp and just accessed that instead.