Roman 787b285227 任务:新建项目 导入必要的插件
1.导入URP
2.配置了URP
3.导入Dotween
4.导入Odin
5.导入了InputSystem
6.设置项目为新旧输入系统并用
7.导入了FunGus
8.创建了一些空文件夹

我是每日提醒上班小助手,今天你上班了吗?😺
2022-03-10 22:49:14 +08:00

55 lines
2.2 KiB
C#

// This code is part of the Fungus library (https://github.com/snozbot/fungus)
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
// Adapated from http://wiki.unity3d.com/index.php/EnumFlagPropertyDrawer
//placed in fungus namespace to avoid collisions with your own
using System;
using System.Reflection;
using UnityEditor;
using UnityEngine;
namespace Fungus
{
[CustomPropertyDrawer(typeof(EnumFlagAttribute))]
public class EnumFlagDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
EnumFlagAttribute flagSettings = (EnumFlagAttribute)attribute;
Enum targetEnum = GetBaseProperty<Enum>(property);
string propName = flagSettings.enumName;
if (string.IsNullOrEmpty(propName))
propName = property.name;
EditorGUI.BeginProperty(position, label, property);
#if UNITY_2017_3_OR_NEWER
Enum enumNew = EditorGUI.EnumFlagsField(position, propName, targetEnum);
#else
Enum enumNew = EditorGUI.EnumMaskField(position, propName, targetEnum);
#endif
property.intValue = (int)Convert.ChangeType(enumNew, targetEnum.GetType());
EditorGUI.EndProperty();
}
static T GetBaseProperty<T>(SerializedProperty prop)
{
// Separate the steps it takes to get to this property
string[] separatedPaths = prop.propertyPath.Split('.');
// Go down to the root of this serialized property
System.Object reflectionTarget = prop.serializedObject.targetObject as object;
// Walk down the path to get the target object
foreach (var path in separatedPaths)
{
var t = reflectionTarget.GetType();
//with support for private types via https://gist.github.com/ChemiKhazi/11395776
FieldInfo fieldInfo = t.GetField(path, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
reflectionTarget = fieldInfo.GetValue(reflectionTarget);
}
return (T)reflectionTarget;
}
}
}