Return Types UE5
We are going to be creating our own fucntions from scratch, input functions ,and our own nodes as well.
In the my blueprint tab under functions we are going to click on the + and create our own function which we will name test.
This will open up our new functions tab with our entry node as well.
To get our own set of input pins and output pins on our function let’s left-click on the function we created back in the blueprints tab and look over at the details. You can see there is a section for inputs and outputs. If we add a input click on +.
If we created an integer input with a value of 0 and saved it.
And when we bring test into our blueprint we can see Test1 has a value of 0 as it was set in our functions default input value for it.
If you click outputs and add an output, we will get a return node.
We can take our input multiply it by 2 and hook it up to our output know and hook up our execution pins. Though this will give a result of 0 as we are still multiplying by 0 as our default value.
So now we are going to see if our gun has ammo.
We are going to take our ammo greater than 0 and collapse it to a function.
We are going to rename it to has ammo and then hookup our execution pins before our branch.
If we run our program we get the same results we have just cleaned up our code some more.