Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Activate Update Methode

Discussion in 'Scripting' started by Tommbett, Jul 31, 2015.

  1. Tommbett

    Tommbett

    Joined:
    Jul 30, 2015
    Posts:
    5
    Hello Community,

    I have a little problem with my update methode... The methode dosent seems to work.. even if I just want to Debug.Log ("XY"); Inside the methode is nothing else.. do I have to activate the methode first?
     
  2. martinmr

    martinmr

    Joined:
    Mar 25, 2015
    Posts:
    325
    show your code pls
     
  3. kemar

    kemar

    Joined:
    Nov 4, 2014
    Posts:
    15
    Nope you don't need to activate the Update method.
    Be sure your method name is correctly writting and your script is attached to a game object in your scene. And your script need to inherits from MonoBehaviour

    C# :
    Code (CSharp):
    1. void Update() {
    2.  
    3.     }
    Js:
    Code (JavaScript):
    1. function Update () {
    2.  
    3.     }
     
    martinmr likes this.
  4. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    A ton of thing have to happen first. In order from most common, here are some classic reasons Update won't run.
    • update used instead of Update. Exact case matters.
    • Script not attached to a GameObject
    • Script not enabled
    • GameObject not active
    • Script does not inherit from MonoBehaviour
    • Script is not saved
    • Logic error inside Update means it is not executing target code
    • Compiler errors prevent entering play mode
    • Play button is not clicked
     
    DonLoquacious likes this.