Boat Attack使用了Universal RP的许多新图形功能,可以用于探索 Universal RP 的使用方式和技巧。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

63 行
1.8 KiB

using System;
using UnityEngine;
using UnityEngine.Rendering;
namespace UnityEditor.Rendering
{
public class DebugUIDrawerAttribute : Attribute
{
public readonly Type type;
public DebugUIDrawerAttribute(Type type)
{
this.type = type;
}
}
public class DebugUIDrawer
{
protected T Cast<T>(object o)
where T : class
{
var casted = o as T;
string typeName = o == null ? "null" : o.GetType().ToString();
if (casted == null)
throw new InvalidOperationException("Can't cast " + typeName + " to " + typeof(T));
return casted;
}
public virtual void Begin(DebugUI.Widget widget, DebugState state)
{}
public virtual bool OnGUI(DebugUI.Widget widget, DebugState state)
{
return true;
}
public virtual void End(DebugUI.Widget widget, DebugState state)
{}
protected void Apply(DebugUI.IValueField widget, DebugState state, object value)
{
Undo.RegisterCompleteObjectUndo(state, "Debug Property Change");
state.SetValue(value, widget);
widget.SetValue(value);
EditorUtility.SetDirty(state);
DebugState.m_CurrentDirtyState = state;
UnityEditorInternal.InternalEditorUtility.RepaintAllViews();
}
protected Rect PrepareControlRect(float height = -1)
{
if (height < 0)
height = EditorGUIUtility.singleLineHeight;
var rect = GUILayoutUtility.GetRect(1f, 1f, height, height);
rect.width -= 2f;
rect.xMin += 2f;
EditorGUIUtility.labelWidth = rect.width / 2f;
return rect;
}
}
}