Gameplay Ingredients是一组用于 Unity 游戏的运行时和编辑器工具:一组脚本的集合,可在制作游戏和原型时简化简单的任务。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

73 行
2.4 KiB

using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
using System.Linq;
using NaughtyAttributes.Editor;
using GameplayIngredients.Rigs;
namespace GameplayIngredients.Editor
{
[CustomEditor(typeof(Rig), true)]
public class RigEditor : IngredientEditor
{
SerializedProperty m_UpdateMode;
SerializedProperty m_RigPriority;
protected override void OnEnable()
{
base.OnEnable();
m_UpdateMode = serializedObject.FindProperty("m_UpdateMode");
m_RigPriority = serializedObject.FindProperty("m_RigPriority");
}
public override void OnInspectorGUI_PingArea()
{
serializedObject.Update();
bool excludedRigManager = GameplayIngredientsSettings.currentSettings.excludedeManagers.Any(s => s == "RigManager");
if (excludedRigManager)
{
EditorGUILayout.HelpBox("This Rig depends on the Rig Manager which is excluded in your Gameplay Ingredients Settings. This rig component will be inactive unless the manager is not excluded.", MessageType.Error, true);
if (GUILayout.Button("Open Settings"))
Selection.activeObject = GameplayIngredientsSettings.currentSettings;
}
EditorGUI.BeginDisabledGroup(excludedRigManager);
EditorGUI.BeginChangeCheck();
DrawBreadCrumb("Rig", color, () =>
{
GUILayout.Label(ObjectNames.NicifyVariableName(serializedObject.targetObject.GetType().Name));
GUILayout.FlexibleSpace();
OpenIngredientsExplorerButton(serializedObject.targetObject as Rig);
});
using (new GUILayout.VerticalScope(EditorStyles.helpBox, GUILayout.ExpandWidth(true)))
{
GUILayout.Label("Rig Update Properties", EditorStyles.boldLabel);
using (new EditorGUI.IndentLevelScope(1))
{
NaughtyEditorGUI.PropertyField_Layout(m_UpdateMode, true);
NaughtyEditorGUI.PropertyField_Layout(m_RigPriority, true);
}
}
DrawBaseProperties();
if (EditorGUI.EndChangeCheck())
{
serializedObject.ApplyModifiedProperties();
}
EditorGUI.EndDisabledGroup();
}
static readonly Color color = new Color(1f, .5f, .1f, 1f);
}
}