Search Unity

void start run 2 times

Discussion in 'Scripting' started by Vindatra14, Aug 31, 2015.

  1. Vindatra14

    Vindatra14

    Joined:
    May 8, 2015
    Posts:
    87
    I have this code at my void start, but why it run 2 times at the debug log, ita happen not only at start but at my UI button too. can some1 explain this Untitled.jpg
    Code (CSharp):
    1. void Start () {
    2.         Debug.Log ("start");
    3.     }
     
  2. RiokuTheSlayer

    RiokuTheSlayer

    Joined:
    Aug 22, 2013
    Posts:
    356
    Log the name of the object. You probably have another object with the script on it
     
  3. Vindatra14

    Vindatra14

    Joined:
    May 8, 2015
    Posts:
    87
    ooh like that, I have empty gameobject where the script I use. And at the same time I load that script in my UI button. How I make it just 1 script at all, I'm newbie at Unity
     
  4. RiokuTheSlayer

    RiokuTheSlayer

    Joined:
    Aug 22, 2013
    Posts:
    356
    Just don't use the script on more than one object.
     
  5. Vindatra14

    Vindatra14

    Joined:
    May 8, 2015
    Posts:
    87
    ok, I'll try and thanks for the explanation