Teaching Newbies since 2014

kauress

  • Home
  • Javascript ❤
    • JavaScript
    • Node.js
  • WebDev Tuts
  • screencasts
  • Resources
  • VR & AR
  • Contact
  • Github
  • Twitter
  • YouTube
  • RSS
  • C++
You are here: Home / Unity3D / Unity3D Scripting API #3 – Start() 🏁

January 24, 2021 by: Kauress

Unity3D Scripting API #3 – Start() 🏁

💚MonoBehaviour💚 is the base class from which every Unity script derives. Any Unity3D script that you create will extend from the MonoBehaviour class.

The MonoBehaviour class will execute events in a pre-determined order.

🍱Method: A method is a function that performs a specific task. So these methods are performing a specific function. For example whatever code is written inside the Start() will execute on the first frame of the game.

⭐ Start(): This method is called on the first frame of the game before Update() is called and after Awake(), onApplicationPause(), onApplicationFocus() and OnEnable()

🍩Called only once in a life cycle of a script attached to an object

🍩 Executed only if the script component is enabled
🍩 You will see this added automatically to your scripts when you create them
🍩 You will often set up variables or make references to other game objects from a script before the game begins and this happens in inside Start()
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CubeController : MonoBehaviour
{
    // Start is called before the first frame update
   // void means that there is no return value
    void Start()
    {
      

    }

}

Full list here: https://docs.unity3d.com/ScriptReference/MonoBehaviour.html

Unity3D Scripting API -2: MonoBehaviour
Unity3D Scripting API #4 : Update() ☑️

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Copyright © 2021 ·Kauress