EditorPrefs.Set*() when using -batchmode -quit under MacOSX

Hi!

I have a EditorWindow implementation that I’m trying to save preferences for under MacOSX. In particular, I’m doing it from a command-line script that invokes Unity using -batchmode -quit.

This is roughly what I have:

public class MyEditorTool : EditorWindow {
	const string PREF_KEY = "MyEditorTool/MyStringPreference";

	public static void SetPreferenceFromCommandLine() {
		string[] args = Environment.GetCommandLineArgs ();
		int argIndex = 1;
		...
		// (Scan for the appropriate command-line option index)
		...
		EditorPrefs.SetString (PREF_KEY, args[argIndex]);
	}

	...
}

So under MacOSX, I have a script that sets up the preference for a particular project that does the following:

/Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode \
  -executeMethod MyEditorTool.SetPreferenceFromCommandLine \
  -projectPath <project_path> \
  <my_preference_value>

Under MacOSX, this doesn’t seem to work if -quit is specified. However, without -quit, it works if I close the Unity App.

Under Windows, the equivalent command line works with -quit.

Am I missing something to commit the change to the preferences?

Thanks in advance.

I managed to find a workaround by adding EditorApplication.Exit (0); at the end of my SetPreferenceFromCommandLine() method above.

It doesn’t appear to cause problems with also having -quit specified.