How to get reference from blueprint object to not yet spawned player

Hi there!
So I have a blueprint which decides, based on the distance between the player and its (self) world location to do things. There are many instances of that blueprint and all of those should perform that operation.

The issue comes from referencing the player itself. Inside that blueprint I’m using a public variable which I later would want to set to the player instance at the level blueprint, in order to reference him. However I can’t get a reference during non-runtime to the player because I’m using the PlayerStart object to spawn him and it doesn’t exist yet

So, any clues on how to reference the player in this situation?
(by the way I’ve checked the reference assets wiki page and yet I can’t get it to work)

Thanks

Is there only one player? You can Get Player Character => Cast it to your character class => save to the variable on Begin Play.

If you have multiple pawns, you can get them with Get All Actors of Class, and then select the one you need from the array.

If the Blueprint has the BeginPlay event available, you should use that - it’ll guarantee that the world exists at the time of execution. You can create a public variable on your Blueprint of the player type and then on BeginPlay you can set that variable to the casted version of the player. You can get the player by using Get Player Character at index 0, assuming it is a singleplayer game. Afterwards, you will have to cast it to your specific player class so you can use your custom properties/methods.

That worked, thanks!
As a side note, this solution had to be done at the level blueprint (like this).