예제 #1
0
 public static void MarkEntriesDirty()
 {
     if (!entriesDirty && Preferences.Enabled && Preferences.IsButtonEnabled(warnings))
     {
         entriesDirty = true;
     }
 }
예제 #2
0
        static LogEntry()
        {
            try {
                logEntriesType = ReflectionHelper.FindClass("UnityEditorInternal.LogEntries");
                logEntryType   = ReflectionHelper.FindClass("UnityEditorInternal.LogEntry");

                if (logEntriesType == null)
                {
                    logEntriesType = ReflectionHelper.FindClass("UnityEditor.LogEntries");
                }
                if (logEntryType == null)
                {
                    logEntryType = ReflectionHelper.FindClass("UnityEditor.LogEntry");
                }

                ReloadReferences();
            }
            catch (Exception e) {
                Debug.LogException(e);
                Preferences.ForceDisableButton(new Icons.Warnings());
            }

            Application.logMessageReceivedThreaded += (logString, stackTrace, type) => needLogReload = true;

            EditorApplication.update += () => {
                if (needLogReload && Preferences.IsButtonEnabled(new Icons.Warnings()) && Preferences.Enabled)
                {
                    ReloadReferences();
                    needLogReload = false;
                }
            };
        }
예제 #3
0
        static LogEntry()
        {
            try {
                var logEntriesType = typeof(Editor).Assembly.GetType("UnityEditorInternal.LogEntries", false);
                var logEntryType   = typeof(Editor).Assembly.GetType("UnityEditorInternal.LogEntry", false);

                if (logEntriesType == null)
                {
                    logEntriesType = typeof(Editor).Assembly.GetType("UnityEditor.LogEntries", false);
                }
                if (logEntryType == null)
                {
                    logEntryType = typeof(Editor).Assembly.GetType("UnityEditor.LogEntry", false);
                }

                getEntryMethod      = logEntriesType.GetMethod("GetEntryInternal", ReflectionHelper.FullBinding);
                startMethod         = logEntriesType.GetMethod("StartGettingEntries", ReflectionHelper.FullBinding);
                endMethod           = logEntriesType.GetMethod("EndGettingEntries", ReflectionHelper.FullBinding);
                logEntryConstructor = logEntryType.GetConstructor(new Type[0]);
                logEntryFields      = new Dictionary <string, FieldInfo>();

                foreach (var field in logEntryType.GetFields())
                {
                    logEntryFields.Add(field.Name, field);
                }

                ReloadReferences();
            }
            catch (Exception e) {
                Debug.LogException(e);
                Preferences.ForceDisableButton(new Icons.Warnings());
            }

#if UNITY_5 || UNITY_2017
            Application.logMessageReceivedThreaded += (logString, stackTrace, type) => needLogReload = true;
#else
            needLogReload = true;
#endif
            EditorApplication.update += () => {
                if (needLogReload && Preferences.IsButtonEnabled(new Icons.Warnings()) && Preferences.Enabled)
                {
                    ReloadReferences();
#if UNITY_5 || UNITY_2017
                    needLogReload = false;
#endif
                }
            };
        }