Search Unity

Button OnClick() Editor And Runtime VS Runtime Only

Discussion in 'UGUI & TextMesh Pro' started by Sudarmin-Then, Nov 27, 2014.

  1. Sudarmin-Then

    Sudarmin-Then

    Joined:
    Nov 27, 2014
    Posts:
    27
    What is the difference between both of these (Editor And Runtime & Runtime Only)
    It looks like both only works when I Run the game, when I'm in edit mode and go to the Game tab, the button doesn't do anything. Just curious what's the Editor And Runtime used for?
     
    aymusbond likes this.
  2. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    It's not just for the Button it's for the underlying UnityEvent. Take for example a slider, you may modify the value and expect it to trigger a callback to modify some text. In this case if you are modifying the value in the inspector you want it to trigger a text update (hence editor & runtime) when you are not in play mode.
     
    Sudarmin-Then likes this.
  3. Sudarmin-Then

    Sudarmin-Then

    Joined:
    Nov 27, 2014
    Posts:
    27
    Oh I get it now, it worked on Slider on Editor and also on Runtime when I play it. Thanks for the reply! :)