Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is MonoBehaviour in Unity 3D?

Tags:

c#

unity3d

using UnityEngine;
using System.Collections;

public class VariablesAndFunctions : MonoBehaviour
{   
    int myInt = 5;
}

The full code is here Unity Official Tutorials

What is the purpose of MonoBehaviour

like image 467
shafik Avatar asked Jan 13 '17 09:01

shafik


1 Answers

MonoBehaviour is the base class from which every Unity script derives. It offers some life cycle functions that are easier for you to develop your app and game. A picture is worthy of thousands of words.

Source of the image: https://docs.unity3d.com/uploads/Main/monobehaviour_flowchart.svg

enter image description here

like image 106
David Avatar answered Oct 16 '22 14:10

David