Quick Dev Tip #2 UE4 - Blueprints - Pin Splitting

#2 UE4 - BLUEPRINTS -  PIN SPLITTING

Splitting pins is another one of those little Unreal Engine tricks which can help keep your event graph clean and tidy. I didn’t know about it for a long time and now I use it all the time.

Below is an example of the normal way that you could “break” a vector, manipulate one of the values, then “make” it again so you can use it. However, there is an easier and cleaner way to go about it.

02_Splitting_01_NormalWay.JPG
 

If you disconnect everything from the “Get Actor Location”, then right-click on the out pin (which is a Vector), you are given the option to Split Struct Pin.

02_Splitting_02_Split.JPG
 

As you can see below, this splits the vector variable open, allowing you to access the X, Y and Z independently, without the need for a break node. We can do the same to the in vector on the “Set Actor Location” node.

02_Splitting_02_SplitExample.JPG
 

Connecting everything up again, this allows us to get rid of the break and make nodes, making everything much tidier.

02_Splitting_04_Better Way2.JPG
 

This method should work with anything that is a struct. For example, a vector is basically a holder for three float values. Another example is a Rotator like in the “Get Actor Rotation node”. This can be split into it X (Roll), Y (Pitch) and Z (Yaw).

02_Splitting_05_Rotator.JPG
 

If you want to, you can recombine these pins by right-clicking on anyone one of the three and pressing Recombine Struct Pin. However, this is only going to work if you have nothing attached to any of the pins.

02_Splitting_06_RotatorRecombine.JPG
 

You can also split things that have been split. In the example below, I split a struct I made and then I split the MyCurrentCharColour variable again. I can do this because Linear Color Structure has 4 float values inside.

 

However, splitting isn’t always the best idea. I find if you split too many times it can start to get harder to read. So in the previous case where we are trying to get to a specific value in the Linear Color Struct, I would instead split the main struct once to expose the main variables inside then use a break node for the linear color. This is easier to quick read and also it allows you to move the break node closer to where you need it.

02_Splitting_08_Not always the best.JPG


If you want more tips and tricks make sure to give me a follow on Twitter @cbGameDev

Also, check out the parkour game I'm solo developing called Freerunners. Give it a wishlist if you like the way it looks!: https://store.steampowered.com/app/1430330/Freerunners/