Blueprints missing core functions?

Hey so I started coding using blueprints, but it seams some nodes are missing, or they have weird names and I cannot find them. They should exist though, cause they are the most basic and esential functions for any script.

The nodes I need:

A node that takes in an Exec and a boolean and outputs 2 different Execs depending on the boolean value.

A node that can take any variable and write its value to memory as a new global variable.

First one is even easier :slight_smile:

IF

It’s an if, just search for ‘if’.

Its generally called an If in programming in UE4 it’s also called a branch (as well as if) in blueprints, you can get it by typing “branch”, “if” or just by holding down B and clicking.

Hope that helps. :slight_smile:

Nothing shows up if I search for ‘if’. I ended up using ‘Switch on Int’.

I know it is called an ‘if’ in programming - that’s why I couldn’t find it.
It is called a ‘switch’ in Unreal Engine.

Nope. Maybe ‘branch’. But you get it when you search for ‘if’.

image

Oh, I see.
Thanks! This one is better.
I was converting bool to int and using ‘switch on int’ but this one is better, since I don’t have to convert the type of the variable.

Do you have a picture of the other one you can’t find?

The other one (the global variable) I cannot find any way to do at all.
What I want is a variable that I can Get and Set from any blueprint in the entire game without referencing anything. Just a value that is held in memory from when it is first set and then is flushed from memory when the app is closed.

Then that variable would have to live in the game instance

I do have them in game instance but I get en error when I try to set them in a different blueprint.
It says ‘Cannot place variable […] in external scope […]’.
Why does that happen?

So you get the game instance, then you have to cast to your game instance, then set the variable?

Ok, so in the blueprint im trying to write the global variable I use the ‘Cast to GameIstance’ node, and I plug in ‘Get Game Instance’ as an input object, right? And what do I need to do next?

Edit: Like I do not see that ‘Set’ node. It doesn’t show up in search.

Like this

You also have to say you want to use your game instance in the project settings:

I did set the projet to use my game instance.

But how do you spawn the ‘Target My Variable’ and the ‘Set’ nodes. I don’t know how to add those nodes to the blueprint - they do not show up in search.

Drag from the node and type ‘myvariable’ ( or whatever your variable is called ), and you’ll see the get and set nodes…

Ok, I got it. Thank you!

1 Like