From the course: Learning Unity 2D Scripting

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Intro to MonoBehaviour

Intro to MonoBehaviour - Unity Tutorial

From the course: Learning Unity 2D Scripting

Start my 1-month free trial

Intro to MonoBehaviour

- [Instructor] Now that we have a basic idea of how scripting works, let's take a look at some specific Unity features when it comes to architecting the code we'll use in our game. To get started, let's open up our Hello World script. Previously, we added some logic to the start method of our script. If you remember when we created our default script, we only had two methods in it: start and update. Let's go ahead and delete all the contents inside of start, and restore this back to how it looked when we originally created the script. Let's just leave the name field and focus on these two methods. Our script Hello World extends the script mono behavior. Mono behavior is the base class that all Unity scripts extend. In order for us to attach this script onto a game object in our scene, it has to extend the mono behavior. Not only does this help define all of the logic that a game object can use, but it also gives us different ways for us to execute code, based on Unity's own life…

Contents