Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Difference between Start() and Awake() in Unity3d

    • 0
    • 2
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 2.20k
    Comment on it

    Here is an small intro of unity initialisation function name start and Awake.

    Start

    Start function is called only if the script component is enabled.
    Start and Awake both are only called once in a lifetime.
    Start function is called up after Awake and it execute after the first frame Update.

    Below is an example showing start function in unity C# :-

    using UnityEngine;
    using System.Collections;
    
    public class ExampleClass : MonoBehaviour {
        private GameObject object;
        void Start()
     {
            object = GameObject.FindWithTag("TestPlayer");
        }
    }

     

    Awake

    Awake function called when the script instance is being loaded.
    As we stated above Awake is also called only once during the lifetime of the script instance.
    Awake allows you to order initialization of scripts.

    Below is an example showing Awake function in unity C# :-

    using UnityEngine;
    using System.Collections;
    
    public class ExampleClass : MonoBehaviour
    {
        private GameObject object;
        void Awake()
     {
            object = GameObject.FindWithTag("TestPlayer");
        }
    }

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: