Casting to player character fails when loading level on begin play?

Hi, when I start the game, I want it to open the last saved level, and then feed saved data such as character transform, into the player character, by casting to it.

I’m doing it from the game instance blueprint, but the problem is that the casting always fails, so the character won’t have it’s world position set, or anything else saved for that matter.

If i add even a 0.1s delay between “open level” and “cast to” it works, but then the problem is that I can’t turn it into a function, it’ll bloat my event graph, and delays are a big no-no for me.

What can I do for it to work?

You could split it off to it’s own event graph logic (not the main one) to keep it tidy.

Weird. This is non fix, but is it valid to do the cast /before/ calling Open Level? Maybe the timing problem doesn’t exist if you invert them?

Nope, cuz when you open a level, you spawn a new character, so anything you set into your prior casted character won’t be carried over.

What I did was to move the “set actor transform” function into the character’s begin play. not what I wanted, but it works

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.