We're going to use both ways of capturing and using return variables with two simple debug logs:
- Create a new local variable of the int type, called nextSkillLevel, and assign it to the return value of the GenerateCharacter() method call we already have in place.
- Add two debug logs, with the first printing out nextSkillLevel and the second printing out a new calling method with argument values of your choice.
- Comment out the debug log inside GenerateCharacter() with two backslashes (//) to make the console output less cluttered.
- Save the file and hit Play in Unity:
To the compiler, nextSkillLevel and the GenerateCharacter() method caller represent the same information, namely an integer, which is why both logs show the number 37:
That was a lot to take in, especially given the exponential possibilities of methods with parameters and return values. However, we'll ease off the throttle here for a minute...