- Home /
Does EditorApplication.update get called in -batchmode when calling -executeMethod?
I'm experimenting with trying to get PlayFab's API helpers to work within batch mode for a build script.
It seems its internal HTTP calls rely on Update() to be called to dispatch changes. This presents a challenge as Update() does not get called within -batchmode -executeMethod
mode.
To delay the editor application's exit, I currently use:
while(!_isDone)
{
Thread.Sleep(100);
}
EditorApplication.Exit(0);
One option would be to try to bind EditorApplication.update to call the HTTP client's Update method.
Does EditorApplication.update get called within batchmode/executeMethod?
Answer by GuillaumeCL · Aug 02, 2018 at 03:53 PM
I had the same question as you can ran a test. As far as I can tell, EditorApplication.update does in fact get called when running in batchmode with executeMethod. (As of Unity 2018.2)
Are you sure? I tried it with Unity 2017.4.18f1 and it did get called.
I agree, it does get called. That's what I said.
Oh, I forgot a "not". I tried the following:
public class TestScript {
public static void Run()
{
EditorApplication.update += () =>
UnityEngine.Debug.Log("Hello From Update");
UnityEngine.Debug.Log("Hello From Script");
var isRunning = true;
var i = 0;
while (isRunning)
{
Thread.Sleep(100);
if (i++ == 1000)
isRunning = false;
}
EditorApplication.Exit(0);
}
}
And called it with
Unity.exe -nographics -batchmode -projectPath C:\0\04_unity\TmpProject\TmpProjec
t -execute$$anonymous$$ethod TestScript.Run -quit -logfile testlog.log
The output in testlog.log does not contain the "Hello from Update" logs. Unity Version is 2018.3.5f1.