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

UGUI OnEventListener defaults to Runtime Only

Discussion in 'Editor & General Support' started by imaleper, Nov 25, 2015.

  1. imaleper

    imaleper

    Joined:
    Nov 14, 2012
    Posts:
    30
    Hey Guys,

    Is there any good reasoning behind why the default value of an event listener of a Button or any other UI element is set to Runtime only?

    Surely it would save everyone a lot of time if it defaulted to Editor & Runtime?

    Or perhaps the reasoning is because for a build they should be set to Runtime only?

    Could somebody please explain this to me?

    Thanks
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,852
    The default for an event should be Runtime only, this makes sense in 99% of cases. Editor means the event can be fired when the game is not being played, this means any changes applied by the event will be saved to the scene, not something you normally want. Runtime means the event will only be fired when the game is playing. Perhaps you have confused the terminology and took Editor to mean runtime mode in the editor?
     
  3. imaleper

    imaleper

    Joined:
    Nov 14, 2012
    Posts:
    30
    Yes that is exactly what I did. How stupid. I was executing a UI script in Editor and got confuddled... Thanks
     
    karl_jones likes this.