Return Type Functions
Objective: Understand what return types are and how to use them.
A return function is a type of function. You can assign a return function to a variable. To do this you would take this exampled method below.
To change this void function into a return function we remove the void and replace with a variable.
Having a return function means you can us this function on several variables.
Using the sum function, we created we can call on it with the parameters. With the variables being public we can see the result in the inspector.
This is a basic use of a return function. We could use a return function for many different applications of features. For example, we could use a return function to change the position. We start by creating a vecor3 return function.
Now you add the call function where you want this method to take effect. for this tutorial I put this in the void start.
Now you have you position changed using a return function. There are many ways you can use a return function for your program. Don’t be afraid to experiment with your code, and I’ll see you in the next tutorial.