Cast to Third Person becomes invalid

Hi all
I have an issue when my “Cast to Third Person” (promoted to a variable) becomes invalid after about 4min30s (losing all references I am calling)

I am accessing variables saved in my third person blueprint for a menu system (sound volumes, graphics settings) to display and interact with them in the menu. It is responding
like I have called destroy actor on the variable (even though there is no call to destroy actor)

I tried to call IsValid - false and create it again but if I cast it again it doesn’t create it again.

I get a “pending kill or garbage” error message when I leave the simulation.

Screen while cast is working

Screen after cast has failed

Code calling the variables from third person blueprint



Does anyone have ideas on how to fix this? Does it have a life span before it is automatically killed?

I’ve been doing more testing, this error only occurs when I call the UI menu (and casting) from a blank level (Menu Menu level, only calls the UI)

If I call it from the third person player blueprint (as a pause menu) it does not ‘time out’ and lose the cast.

  • move the cast + reference to Event On Initialized instead of Event Construct - does it help?
  • the widget holding the character ref, does it get removed from the Viewport. What references it?

I have just tried using the event on initialized but still get the same error with the cast being lost.

The widget is added to the viewport in the level blueprint (it is a blank level called “MainMenu”)


This is the only coding on the level blueprint.

I am guessing this is where the issue is occurring, if I call it as my player during gameplay it works as expected (can stay on the pause screen for infinite time without losing the cast).

When it is from the MainMenu level, I can leave it on the screen with the volume controls and it will lose the numbers at the same time (4m30s) They disappear from the screen

The widget is added to the viewport in the level blueprint (it is a blank level called “MainMenu”)

Do you ever load another level?


You’re adding the widget to the viewport but do not set a reference. Which could be fine under regular but here we might be dealing with something uncanny. Perhaps that could help.

At this stage it’s not calling any other levels to load, just idle on this ‘level’.

However, I added the “Set Game Paused” (even though there is nothing to pause) call to the Begin Play code above, this seems to have fixed the issue.

1 Like

Oooh, that’s intriguing. 4:30 you say? Here’s something I’ve never heard about before… Nice one.


This is a mystery, though.

Do you have any timers ticking, triggering something that might have been abandoned or forgotten?

1 Like

It may be an issue with the engine itself.

I tried making a new project with nothing in it (Unreal Engine 5.0.0, Third Person Game project without starter content)

  • Added a variable to the 'BP_ThirdPersonCharacter" called volume (float type)
  • Added a new “Empty Level” just calling the UI

  • Created a widget blueprint with a text box bound to the volume

After the 4m30s mark the cast is lost (no error messages displayed) The number from the cast disappears from the screen.

If I add the pause call it stays on the screen.

Sorry for multi replies, forum won’t let me add multiple embedded images in one post

Oh, if you mean that the pin on the cast node becomes invalid, then this is not a bug. I thought you were getting a null reference from a variable:

I have an issue when my “Cast to Third Person” (promoted to a variable)

Could you demonstrate what, where and when exactly triggers the warning.


This, while inefficient, should be fine, though - assuming this is bound to a widget.

This is the widget blueprint in designer view

The binding to the VolumeNumber text (function Cast Text)

The level running in viewport (left monitor/view) with the level blueprint on the right.

After it has been running for the 4m30s the displayed number in the widget (number 5 in this example) disappears unless the blueprint has the “Set Game Paused” set to TRUE.

This is a blank project with no other factors.

Thanks for the clarification!

Yeah, that does not seem right. I wonder if that’s a UE5 thing / bug - seems like it now. That bound function fires non-stop, every frame - the cast node can’t expire.

the displayed number in the widget (number 5 in this example) disappears

Out of sheer curiosity, is it the entire widget that goes missing or the text disappears because the variable cannot be accessed? Like, if you had a border - would it also go missing?


One note, hear me out - it’s a wild theory! There is something called killZ - if the character falls out of the world, that actor gets destroyed. What are the chances that your character simply keeps falling and gets killed by the killZ volume?

Put a platform under their feet, see what happens.

This may be completely irrelevant but it would explain nicely why pausing works…

edit: this

image

1 Like

That is what it is, I added a box for the player to spawn on to and it works. If I make the player jump off the box it causes the loss of the cast. It was only the number from the cast being lost. Any border, buttons, images remain on the screen.

1 Like