This week’s Training Stream takes a look at Blueprint Communication. We find that Unreal Developers of all levels can sometimes struggle through the concepts behind moving data between objects. So this week we’ll take a look at the different ways to make Blueprints talk to one another, how to know which one to use and when, as well as some performance considerations.
Tuesday, Feb 23rd @ 2:00PM-3:00PM ET - Countdown
Feel free to ask any questions on the topic in the thread below, and remember, while we try to give attention to all inquiries, it’s not always possible to answer everyone’s questions as they come up. This is especially true for off-topic requests, as it’s rather likely that we don’t have the appropriate person around to answer. Thanks for understanding!
Yup, Level Blueprint to others is something I always feel dirty about (by either placing things in the world and passing that in, or doing other hocus-pocus that just doesn’t seem right).
In particular, something I felt very terrible about doing was interacting with BP Actors dynamically placed in the world that should react to a Matinee playing (since the Matinee only likes to talk to the level).
That’s a little bit tricky, but it doesn’t always have to be. Getting a reference to the Persistent Level can be a bit of a pain. If I had to do something like this, the first thing I would try would be:
In the Game Mode or Game State (depends on your setup), make an Event Dispatcher with no inputs. For this example let’s call it “MatineeResponse.”
Also in the above, make Custom Event (we’ll call this “MatineeEvent”) that calls MatineeResponse.
In Matinee, make an Event Track that pings at your particular event times.
Select your Matinee Actor and in Level Blueprint, create a Matinee Controller for it.
Right-click on the Matinee Controller and refresh it so you see pins for the Event Track.
Off the exec pin for the event track, get a reference to the GameMode/State and call your MatineeEvent Custom Event.
In any actors that need to respond to the Matinee, simply get a reference to the GameMode/State and bind to the MatineeResponse Event Dispatcher.
If level blueprint were accessible from anywhere, like if you could have ‘get level blueprint’ callable alongside get gamemode/ get player controller etc that would be cool. Since the Game Mode, Game State, Player Controller are essentially per-level anyway. It would bridge the gap between the level blueprint and the rest of the framework.
can anyone explain why unreal engine 4 is making updates that break nodes in existing BP? i’ve been following along with tutorial videos, and often there’s something that doesn’t work due to a node not being available, or a node returns a compile error.
I’m kind of noob, and I only have youtube resources available. It’s hard for me to do anything when tiny pieces of the puzzle are snipped out on a bunch of the tutorial videos that people have made.
Edit (this also looks true for a bunch of the content that i’ve bought on the market)
any chance you could also discuss blueprint execution order? sometimes i have to drop a brief delay after the ‘begin play’ for one blueprint to successfully cast a reference to another. have read a bunch of answerhub stuff on this, but have seen varied methods to handle this.
I’d really like to see this topic covered in the stream because I think this is a common problem.
My soulution for this issue works but feels a little bit hacky because what I do to solve this problem is building a macro that retriggers itself for every Frame and checks if the input object is valid or not. Once it’s valid, the Loop breaks. This works very well but I’m Not sure if it’s a clean Way to solve the issue.
Hey Zak! Really looking forward to this one. I’m a big fan of your tutorials on UE4 YouTube channel.
I would love learn more in-depth about casting and what in your opinion are robust and elegant practices for communicating between blueprints. For example, if you have time it would be awesome to see you approach things like this:
A Projectile BP that on Hit or Overlap event would affect*(meaning: communicate damage or initiate any other custom event within a different BP)* a multiple different types of enemies *( meaning: not just one kind of Enemy BP as it’s usually shown in tutorials or help documentation, but rather multiple different enemies communicating to each a specific effect such as damage value or any other custom event). * The way I currently address that is by adding another “Cast to” node to “Cast Failed” output and then a new “Cast to” in-to the new node’s “Cast Failed” output and so on, continuing branching out. It’s working fine right now, but I only got 3 different types of enemies. Would it still work when I have 20+ different types of enemies in the game? Wouldn’t the lag be noticeable since it would have to go through 20 failed casts before it gets to the right one? If I only had let’s say 1 kind of Projectile then I could perhaps just communicate with it from an individual enemy BP. But since I plan on having various different types of weapons(hence new projectile BPs) it seems this wont be very elegant either. So I’d say the ultimate mega question would be is there a way to set up a system with 20 enemies BPs and 20 projectile BPs that all talk to each other effectively through casting? Or there is another way? Thanks a lot for your time!
i have a question… when binding an event or setting up a timer by event, you connect the event with the dispatcher or timer using the red dot, and have the sequence of events from the ouput of the event… but that can get messy with red lines going all over the place… is there any other way to connect them together, or do you just keep it clear with some reroute nodes ?
I’m going to tackle some of these now in case the stream runs long. You’ll probably thank me later.
You can’t do this with the Persistent Level Blueprint. It’s special.
What you can do, however, and really works just as well, is to make a sublevel that houses all of your Level Blueprint and make sure all your BP gameplay stuff is in there. You can then implement an interface on a sublevel (gasp!) and send signals that way. We’re going to be going over this in the stream briefly. It’s super easy and once you see it you’ll have one of those “lights on” kinds of moments.
Look in Content Examples, the Blueprints Advanced map, I think. That has one way to do it. I generally use different triggers on each side of the door triggering different Timelines. It’s not as elegant but it’s easy to set up.
We really are sorry about this. Sometimes it happens. We have to update systems for a lot of reasons. Sometimes it’s performance, sometimes a new feature, or sometimes something unrelated that happens to touch the same code. The simple fact is sometimes you’ll have to refactor your Blueprints, the same way you might have to refactor your code if we changed something fundamental. It’s the nature of the beast and we apologize for the inconvenience.
That said, it looks from here like you have access to more than YouTube. It’s clear you also have access to the forum, and if that’s the case you probably also have access to the AnswerHub. So make use of that and report regressions when things break. We might have to tell you that it’s intended behavior (again, sorry!) but then again, we might not! It might be a bug.
Yeah that happens. Especially if you’re doing something like referencing the player in the GameMode. It’s not even BP execution order. It’s class creation order. And I won’t go so far as to say “it’s a mystery,” but the actual process of how each thing gets created is a little complex. Generally speaking, when I run into those kinds of things, I run in the other direction. Don’t have the GameMode ask for a reference on BeginPlay. Instead, have the player (or whatever class) transmit to the GameMode with a reference to itself, which just populates an empty variable and calls a Custom Event which you’d use instead of BeginPlay.
We’ll discuss them thoroughly. They’re huge and they’ll change the way you look at communication.
FredrickD has already got your back. Use a BP Interface. We’ll talk about how those work which will hopefully help.
Yes and no. The red lines and such are necessary, no way around it. You could, however, use internal Custom Events as if they were wireless receivers. I do this sort of thing sometimes. Your timer ties to a custom event that does nothing but call another custom event somewhere else in your graph, enabling you to have one short wire to the event call, if that makes sense.
Zak is hands down the best tutorialist and teacher in all things “unreal” As I’ve been developing my own game, my learning about the data between blueprint’s and their cross-communication ability has been slow-going at best. In essence, there’s probably several ways to get the results needed through brute-force blueprinting (as I’ve done), but a dynamic game build is ideal!
Having a lot of small pieces of my game completed, I’m anticipating today’s live training will fill in these loose gaps in my (and other developers) game creation/s.
With only a few hours away…
Thanks for putting on the show Zak!
Really looking forward to this one. I recently just started using Event Dispatchers; they’re awesome but not massively well documented right now (largely because they’re quite different from everything else in BP) so having it on stream will be great!