As you see, (winkeyofcharacter) is a variable from blueprint (mycharacterblueprint).
When I play testing and press O and L, I can see (winkeyofcharacter)'s value changed in (mycharacterblueprint) and
level blueprint successfully access the (winkeyofcharacter) of (mycharacterblueprint)
but it only checks (winkeyofcharacter)'s default value(false), not changed value(true)
I want to know how to access the (winkeyofcharacter)'s changed value(true)
did not get what you exactly want but a better solution for such situation is to have a setter function in your characterBP and calling that function from level BP.
add a blueprint function and make an input variable for that and then inside function set your variable using that input. now you can call that function from level BP.
if you want to get that variable make a getter function.
If you really need the setup with level blueprint, please check that the MyCharacterBlueprint is directly added to the level in the editor and not re-spawned somehow else (e.g. if it’s a player’s character, then it will be respawned on the game start by the engine, I guess), probably that’s why you get the default value.
So, to handle this, you need to pass the reference somehow to the level blueprint. You can do this through the PlayerController or GameInstance (for this purpose, don’t use it in case of multiplayer) or any other consistent objects.
But, as I said, it’s better not to use Level Blueprint at all.
It’s not really a good way since the get all actors of class may be pretty heavy in case of a lot of actors in scene. It will iterate over ALL actors to find the actors of the requested class.
controller logic is only for testing like print string.
I sovled this problem by setting getplayerpawn and casting instead of referncing character blueprint.
whatever, thank you for answering
Cool! if it’s about getting the player character then it’s completely fine to use GetPlayerPawn – in fact, internally, it’s exactly the way I suggested – to keep the reference in some known object (e.g. Player Controller).
Yes that’s true, but in this case he want to get his PlayerCharacter Ref so, i guess there will be only one. However this method will not work for a multiplayer game.