浏览代码

Merge pull request #88 from Unity-Technologies/siyaoH/1.17.5/fix3

add debug log config
/siyaoH-1.17-PlatformMessage
GitHub 4 年前
当前提交
05c39daf
共有 3 个文件被更改,包括 30 次插入2 次删除
  1. 6
      com.unity.uiwidgets/Editor/UIWidgetsPanelEditor.cs
  2. 21
      com.unity.uiwidgets/Runtime/engine2/UIWidgetsPanel.cs
  3. 5
      com.unity.uiwidgets/Runtime/foundation/debug.cs

6
com.unity.uiwidgets/Editor/UIWidgetsPanelEditor.cs


base.OnInspectorGUI();
var pixelRatioProperty = serializedObject.FindProperty("devicePixelRatioOverride");
var antiAliasingProperty = serializedObject.FindProperty("hardwareAntiAliasing");
var ShowDebugLog = serializedObject.FindProperty("m_ShowDebugLog");
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(ShowDebugLog);
if (EditorGUI.EndChangeCheck()) {
UIWidgetsPanel.ShowDebugLog = ShowDebugLog.boolValue;
}
UIWidgetsPanel panel = (UIWidgetsPanel)target;
serializedObject.ApplyModifiedProperties();

21
com.unity.uiwidgets/Runtime/engine2/UIWidgetsPanel.cs


}
}
public bool m_ShowDebugLog = false;
public static List<UIWidgetsPanel> panels = new List<UIWidgetsPanel>();
public static bool ShowDebugLog {
get => _ShowDebugLog;
set {
foreach (var panel in panels) {
panel.m_ShowDebugLog = value;
}
_ShowDebugLog = value;
}
}
static bool _ShowDebugLog = false;
protected void OnEnable() {
base.OnEnable();
D.assert(_renderTexture == null);

_ptr = UIWidgetsPanel_constructor((IntPtr) _handle, UIWidgetsPanel_entrypoint);
panels.Add(this);
_ShowDebugLog = m_ShowDebugLog;
var settings = new Dictionary<string, object>();
if (fonts != null && fonts.Length > 0) {
settings.Add("fonts", fontsToObject(fonts));

_handle = default;
_disableUIWidgetsPanel();
panels.Remove(this);
D.assert(!isolate.isValid);
base.OnDisable();

5
com.unity.uiwidgets/Runtime/foundation/debug.cs


using System;
using System.Diagnostics;
using System.Linq;
using Unity.UIWidgets.engine2;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using Canvas = Unity.UIWidgets.ui.Canvas;

[Conditional("UNITY_ASSERTIONS")]
public static void assert(Func<bool> result, Func<string> message = null) {
if (!result()) {
if (UIWidgetsPanel.ShowDebugLog && !result()) {
throw new AssertionError(message != null ? message() : "");
}
}

if (!result) {
if (UIWidgetsPanel.ShowDebugLog && !result) {
throw new AssertionError(message != null ? message() : "");
}
}

正在加载...
取消
保存