Communication in class BPs, call events and functions of a blueprint from another

Hi all, i’m making a pong clone, and i’m trying to make the score update. I have the ball that when hits the bounds behind paddle it updates the scores, calling from the ball graph a function and a event of a score blueprint (i tryied both of them but they do not work) throuhg a reference to the score blueprint saved in a variable. The reference is not null, but the fact is that when i call them, they do not fire in the receiving blueprint but they are public.

Thank you in advance

move your scoreboard content to a Gamestate blueprint (make sure your gamestate is setup in your settings / google how to set a new one up) or the level blueprint. Once you have moved everything across you can use get gamestate connected to a cast to gamestate -name-. This should track your score across levels if you want to change up from standard pong

I was trying to understand why functions and events of the score blueprint are not called by the ball actor. Thanks for the tip btw

I don’t see where you are setting the Score_bp_ref variable - perhaps that’s not calling the same score_bp_ref?

Yes it is calling the Score_BP_ref, that i’ve set in the game tab selecting the ONLY instance i had in the level, and the reference were not empty, but the important fact is that in execution both that events and the functions were not called (ie. when i was in playing mode the nodes do not lights up as they should do), still i have this problem

Are you getting your Print Strings as expected?

Yes and nodes lights up on event and function calling but on the functions and events in the score_BP are not lighting up

I still feel like the culprit might be that Score_BP_ref not pointing to the right Score_BP - do you spawn the ball? if you spawn it then you’d probably have to set that Score_BP_Ref variable every spawn…

If you wanted to upload you project somewhere I could download it and take a look, I might be able to help, but

Thank you so much, i resolved it, now i’m doing a simpler things: call an event of the ball from the level blueprint that reset the ball position and apply a force thowards the player’s paddle, but i have the same problem



Just a guess here but you are setting the actor location of the ball, but then applying force just to the sprite? that may not even be what you are talking about but that seemed weird to me… Also in the first picture it’s really hard to tell what’s going on because the picture is so big - can you crop just to the blueprint nodes?

I’ve done it, the second image is a zoom in the end part of the first, when i actually do a cast and try to call the event. For the first thing, well yea i apply force just to the sprite because the add force is oriented on primitives, not on actors or scene components, so to use a function that add a force i have to use that, even if i could use set actor location but it hasn’t the behaviour i expect. To fix it i use set actor location, so the “rest” of the actor (the actor itself, the scene root component and so it’s transform ecc follows the sprites moving the entire actor, a very dumb code but works, and the performance are good (obviously). I want to call it as i can reset the ball to initial position on each point gave either to player or enemy, because i do not spawn the ball, and i don’t want to change it to a spawn behaviour, as i built different scripts to work via references (enemy ball z tracking ecc) and i should change everything and i don’t want to.