Hello guys. I have a problem about how to transfer variables from a BP ACTOR to my Level Blueprint, and for this post i decided to simplify my question with a very simple example because my project is much more complex, but the question is the same.
In my Blueprint Actor, i have a text variable called “Type Of Animal”. I set on the actor differente types of texts, and everything works fine here.
The problem comes when i need to take that variable in my Level Blueprint, because after referencing my actor (i tried to cast to it, getting all actors of class, etc) i take the variable but it gives me the default value (not the cow and not the dog).
Its not an option to replicate the previous nodes before i set the variable because, in my real project, they are huge unlike this example im showing you.
I would appreciate your help very much, thank you guys
Thanks for your reply.
Yes, my variables are public and the inputs of my variables where i set them are enabled (they are not constantly enableed but the events that fire to set them are executed with a click (in the case of my example they are executed after pressing the spacebar and a flipflop to change from cow to dog. It still doesnt work
I know I may sound like a broken record recently, but that’s what [Event Dispatchers] are for:
- Whenever the dog makes a sound:
- The Level Blueprint will be notified:
How you get an actor reference into the LB is another story altogether, though. In 99.999% of cases it is not really necessary, neither is Get All Actors Of Class.
Also, events can be bound and unbound dynamically if that matters.
The Easiest way to move data between actors and the level BP is the game instance, I would say…
Thank you very much, i didnt know you could add parameters values to a event dispatcher, this helped me very much.
And by the way, for those who didnt know this, i had a problem after this relative to the reference of the Blueprint actor where that variable was set. When i added the “bind event to…” in my level blueprint, i tried to connect the target into the reference of my bp actor that i did after geting a copy of it (after “get all actors of class”) and it didnt work. I mean, it allowed me to be connected to that reference but the custom event was not firing when it had to be fired. I solved it adding a reference of my BP ACTOR from my persistent level and i plugged it into the target of my “bind event…” and the custom event was fired correctly. Thank you very much guys, it helped me a lot.