Search Unity

OnClick: Manual or Scripting?

Discussion in 'Editor & General Support' started by Celiken, Mar 12, 2019.

?

How do you set you button.OnClick()? (for the ones that are never changing depending on context)

  1. Via Scripting

    33.3%
  2. Via Editor

    66.7%
  1. Celiken

    Celiken

    Joined:
    Jun 1, 2017
    Posts:
    5
    Hi,

    I woke up with a question in mind today.

    I often see people settings their button onClick via script instead of setting them in editor. I understand that sometimes, you want them to change depending on the context, so this is why. But I can't understand the few ones that are set on Start/Awake method and are never change.

    Is there a special reason for that (little optimization maybe?) or is it just a particular way and there's no optimization difference between both?

    I'm interested of what you guys do.

    Thanks :)
     
  2. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    762
    I always do it via script, because you can follow the code, you can't follow things as easily in the inspector.