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

Editor exit delegate?

Discussion in 'Immediate Mode GUI (IMGUI)' started by wettrix, Nov 4, 2016.

  1. wettrix

    wettrix

    Joined:
    May 25, 2015
    Posts:
    3
    Currently making my own localization extension but would like to know if there is a delegate for when exiting the editor. Mainly to use for saving settings if changed.
    OnDisable doesn't seem to work.

    Anyone know of any function or delegate.
     
  2. AngryAnt

    AngryAnt

    Keyboard Operator Moderator

    Joined:
    Oct 25, 2005
    Posts:
    3,045
    There is none. You should not be dependent on editor shutdown behaviour - makes you vulnerable to not-so-graceful shutdowns (aka crashes). Write your settings when they change.
     
  3. FireBolt-Studios

    FireBolt-Studios

    Joined:
    Dec 29, 2012
    Posts:
    58
    Hmm, I have a similar problem here, I understand why you shouldnt be dependant on shutdown behaviour and you detailed the main reason but how would I go about changing the name of a logfile for archiving when Unity is closed?
    I have scratched my head for a long time regarding this.
     
  4. Xarbrough

    Xarbrough

    Joined:
    Dec 11, 2014
    Posts:
    1,184
    I think it would be acceptable to backup a log file only when the editor starts. As said, you can't expect the editor to shutdown correctly, but it is safe to assume that it starts. InitializeOnLoad will work. You should be able to check for an existing logfile, change its name and only then create a new one.