Methods: The Poké Ball of Code

Andrew Lengen
2 min readApr 1, 2021

--

Methods are essentially a form of modularity; similarly to a Poké Ball (Your Method) holding a Pokémon (Your Code). There are default methods of class MonoBehavior that are used, as well as methods that can be created or more specific methods that have specific functions.

The big ones you’re going to see as soon as you create a C# script in Unity are:

For further Method explanation: https://docs.unity3d.com/Manual/class-MonoBehaviour.html
Privacy?

If you were curious, Unity defaults the methods privacy or “ability to be accessed” to “private” unless defined other-wise. That’s why the method that I had created has a privacy definition, unlike the ones that are shown once you create a C# script.

If I attach this to an empty in our Scene, what should happen is depicted, in order from top to bottom, on the left image:

Looks like we’re good

We’re gonna continue our dive into understanding how to better use these methods but I think we’ve got it so far.

--

--

Andrew Lengen

If ambition and practicality amalgamated, it would be me! I am here to climb the mountains of my ambition and catalog my journey so that someone can be changed!