Esempio n. 1
0
 public static void InitializeWorker()
 {
     // The client here spawned could also be launched from the command line.
     PythonRunner.SpawnClient(CLIENT_PATH,
                              wantLogging: true);
     EditorCoroutineUtility.StartCoroutineOwnerless(WaitForWorkerAndInitialize());
 }
        /// <summary>
        /// Spawns a Shotgun client. This method needs to be called
        /// from a Unity Editor which was launched from Shotgun.
        /// </summary>
        /// <param name="clientPath">The client Python module to use as the
        /// Shotgun client</param>
        public static void SpawnClient(string clientPath)
        {
            if (!VerifyLaunchedFromShotgun())
            {
                return;
            }

            if (Client.IsAlive == true)
            {
                return;
            }

            // Spawn the client
            dynamic pOpenObject = PythonRunner.SpawnClient(clientPath);

            using (Py.GIL())
            {
                Client.PID = pOpenObject.pid;
            }
        }