예제 #1
0
 private static void RefreshRuntimeTypes()
 {
     GearApplication.BackgroundTaskQueue.PushBackgroundWorkItemInQueue(async token =>
     {
         //TODO: Need to update only edited dynamic runtime type
         TypeManager.Clear();
         var dynService = IoC.Resolve <IDynamicService>();
         await dynService.RegisterInMemoryDynamicTypesAsync();
     });
 }
예제 #2
0
        public void RetrieveAllCommands(bool force = false)
        {
            /*  if (!instance)
             *    FindInstance();*/

            try
            {
                if (DebugLog)
                {
                    Debug.Log("Retrieving");
                }

                if (!force)
                {
                    if (CommandCount > 0)
                    {
                        if (DebugLog)
                        {
                            Debug.Log("Canceled because some commands already found");
                        }
                        return;
                    }

                    if (commandsRetrieving != null)
                    {
                        if (commandsRetrieving.IsAlive)
                        {
                            if (DebugLog)
                            {
                                Debug.Log("Canceled because thread is alive");
                            }
                            return;
                        }
                    }
                }

                if (IsLoading)
                {
                    commandsRetrieving?.Abort();
                }

                if (DebugLog)
                {
                    Debug.Log("NOT CANCELED");
                }

                EditorApplication.update -= AddAllFoundCommand;
                EditorApplication.update += AddAllFoundCommand;

                HotKeysManager.Reset();

                lock (infoToAdd)
                {
                    infoToAdd.Clear();
                }
                onlyScanSpecified   = MonKeyInternalSettings.Instance.OnlyScanSpecified;
                assembliesToExclude = MonKeyInternalSettings.Instance.ExcludedAssemblies.Split(';');
                nameSpacesToExclude = MonKeyInternalSettings.Instance.ExcludedNameSpaces.Split(';');

                CommandsByName.Clear();
                TypeManager.Clear();
                IsLoading = true;

                commandsRetrieving?.Abort();

                commandsRetrieving = new Thread(CheckCommandsForAllAssemblies)
                {
                    IsBackground = true,
                    Priority     = ThreadPriority.Normal,
                };

                commandsRetrieving.Start();
            }
            catch (Exception)
            {
                // Unity is not ready yet for instance creation
                return;
            }
        }