How can I create a reference from level to character class?


as in the title, I would like to call a function from the level blueprint to the character class.I tried to create a custom event, but I don’t know what target I should connect…I also tried declaring a global variable, but I need to connect a target then, too.

Thanks in advantage.

You need to get a reference and you need to cast to other blueprint, here are some similar questions, read my Answers:

Unfortunately, that didn’t work. Probably I made some mistake…
I would like to create a reference to a spotlight I use in the player character class (a flashlight)

If your spotlight is in Character Blueprint, then you just need to cast it once like this:

Of course the “GlobalCharVal” needs to be a MyCharacterBlueprint object type.
Now just drag the GlobalCharVal onto the graph and choose “get”, and then drag off pin from the new “Get GlobalCharVal” node and a window with functions will pop up.
So now from this node you have access to the character blueprint content,
and I assume your spotlight is in there.

Ah, I see. First I defined the variable as a light component, because I thought it has to be the type I want to access. Thank you very much, I think this will be very helpful in future!

The other advantage of this is once you arrangement your occasions, you can tune in for them in various spots. Possibly your game mode outline tunes in for the wellbeing changed occasion TV Zion and verifies whether you kicked the bucket. Perhaps your player character verifies whether your wellbeing is sufficiently low to begin a draining molecule impact, and so on. On the off chance that you really just have one other item that necessities to get the occasion, you could simply call a capacity (wellbeing changed, consider the capacity in the HUD that the wellbeing changed). It tends to be simpler to begin with the occasion arrangement in the event that you find more things that need to tune in to that occasion later on however. That way you don’t need to re-do your past diagrams.