Why is passing variables between blueprints such a challenge?

I have spent the 30+ hours in the last week only trying to understand how to pass a transform value between an actor, game state, and level blueprint. I feel I’m no closer to a solution than when I started. Considering the whole point of visual scripting (being to make scripting more intuitive and streamlined) and the fact that flexibility is something you want out of a general use game engine, it seems baffling to me that this be such a mind-bending and difficult to achieve process, but perhaps I am uninformed.

I want an actor that sends its transform to my game state when another actor overlaps it, and then I want my level blueprint to access that transform value. If someone could explain how to so this I’d super appreciate it. Bonus points if you can tell me why it seems so contrived.

Go into Modes and drag out a Trigger, make sure that it overlaps the correct collision channel, for example if its pawn actor that you want to be able to overlap it then make sure it overlaps pawn and that the pawn actor overlaps whatever collision object the box trigger is. But it should by default.
Then right click the box trigger and Add Event>Begin Actor Overlap, then you get to the level blueprint (since its a trigger in a level), from the overlap event created, drag out from the Other Actor and Cast to whatever the blueprint actor that it is you want it to overlap. If its a success you know have access to all of that actors variables such as transforms etc.

You could also make this trigger with a blueprint by using creating an actor blueprint and a collision box component and set correct collision settings and make an overlap event there for the actor you want it to overlap.

I’m not sure what you mean by send the transform to game state, a game state i usually an enum in a GameInstance/GameMode class that has like InGame, IsPaused etc.
Maybe you mean you want to send it to the game mode?

In any case you can get a reference to that in the level blueprint with Get Game Mode or Get Game Instance, cast it to your created game mode or game instance then make a variable reference.

This is all very basic stuff and can be done in 1000 ways so i recommend checking out some tutorials to get a better understanding of actors and blueprints since accessing variables between them can be very easy. Having a blueprint access variables from a level blueprint can be trickier though but can be done using interfaces if the level blueprint implements an interface and returns a value. A level bp can also use delegates which can get called if binded by blueprints.

Know this was alot but hoped it helped :slight_smile:

This tutorial series may be helpful to you as it goes over the foundation of a lot of blueprint “programming” logic. Particularly video #1, #25 and #26 (for level BP communication) for your issues. Hope they help.

I’m not sure what you mean by send the
transform to game state, a game state
i usually an enum in a
GameInstance/GameMode class that has
like InGame, IsPaused etc. Maybe you
mean you want to send it to the game
mode?

It’s a [fully replicated framework class][1], you can extend your own. It’s globally accessible like all framework classes.


I want an actor that sends its
transform to my game state when
another actor overlaps it, and then I
want my level blueprint to access that
transform value.

Actor:

Level:

edit: also Nebula tuts ftw!

Sorry I haven’t responded sooner, was experiencing a bug that prevented me from testing any of this, but that’s resolved.

Basically I’m cheating, I wanted to use my level blueprint to spawn my player because it seemed the easiest way to grab it as a reference for other code I’m using and it was fine for what I was focused on. I’ve since decided for a number of reasons that I should just do it the “right” way. I wanted my transform in my gamestate because it’s for a checkpoint saving system, and I was avoiding using a player controller (because I don’t understand them), but now that I understand better the reasoning behind separating these functions and data I’m going to go ahead and follow the rules to save myself trouble later.

I’m gonna go and post a new question detailing how I might approach some of these things, some (all) of the tuts on this subject seem to be outdated as they use nodes that either no longer exist or have been renamed. I also see several nodes available which seem to be made specifically for implementing a respawn at checkpoint system, but none of the tuts I’ve seen use these nodes. My new question will be something to the effect of “How to properly implement a checkpoint, respawn, and save system using the engines built in implementation.”

The series I linked I just finished in December. I don’t think any of the nodes are outdated…but regardless I hope you find what you’re looking for.

oh sorry that wasn’t directed at the ones you shared at all! I didn’t even think of how it would come off when I said it. I haven’t started the ones you shared yet but I’m eager to. I was referring to all the things I had found with a quick google search (google returning ancient results is really starting to get on my nerves)

Haha, yea…I was like um, I know they have had a few updates (I think I was on 4.18) but it can’t be THAT old yet! Well, glad we got that cleared up. Any who, I still wish you the best finding what you are looking for :slight_smile:

Thanks! Do you remember if any of the videos in your series uses the playerstart/restartplayer nodes? If I’m understanding correctly, these nodes offer nested variables that can easily be manipulates in many blueprints and already handle exactly what I’m looking for.