using System; using UnityEngine; using UnityEditor; using DG.Tweening; using System.Reflection; using UnityEditor.Animations; using UnityEditor.AnimatedValues; namespace SK.Framework { [CustomEditor(typeof(UIView), true)] public class UIViewInspector : Editor { private enum Menu { Animation, Unity...
using UnityEngine; using UnityEngine.UIElements; using UnityEditor; using System.IO; //创建新类型Setting Asset class MyCustomSettings : ScriptableObject { public const string k_MyCustomSettingsPath = "Assets/Editor/MyCustomSettings.asset"; [SerializeField] private int m_Number; [SerializeField] priva...
首先看一下动画相关的几个类的数据结构: usingSystem;usingUnityEngine;usingDG.Tweening;namespaceSK.Framework{/// /// UI移动动画/// [Serializable]publicclassUIMoveAnimation{publicenumMoveMode{MoveIn,MoveOut}/// /// UI移动动画方向/// publicenumUIMoveAnimationDirection{Left,Right,Top,Bottom,TopLeft,...
// Recip.cs public enum IngredientUnit { Spoon, Cup, Bowl, Piece } [Serializable] public class Ingredient { public string name; public int amount; public IngredientUnit unit; } public class Recipe : MonoBehaviour { public Ingredient potionResult; } // IngredientDrawer.cs [CustomPropertyDrawer(ty...
只要Unity的内在类型能够发挥作用,运行时间类型都会存在于UnityEngine命名空间中,而所有的编辑器类型都会存在于UnityEditor命名空间里。 <ignore_js_op> unity-projectlist(from gamasutra) UnityEditor.Editor类 到目前为止,我设立的最普遍的定制是一个自定义检查器。Unity的Inspector面板提供看到组件状态的窗口,但是这种基...
学习自Unity Editor Scripting。 UnityEditor可以让我们更加方便的可视化创建出需要的数据以及prefab等等,本文将使用UnityEditor创建一个窗口来完成一些比较基础的功能。 首先准备一些游戏中的数据,方便我们进行构建,构造如下的文件结构 其中 Editor:用来管理我们从Window的标签下创建的窗口,这是本文的着重点。
public class InspectorBase : Editor where T : UnityEngine.Object { protected T Target { get { return (T) target; } } } 现在,如果我想要为MyCustomComponent创造检查器,我就可以从InspectorBase得到检查器,然后使用“Target”,这样我就不用时常更改了。应当注意的是,你还需要将CustomEditor属性附到检查器...
//EditorGUILayout.EndHorizontal(); return list[index]; } return null; } //在这里方法中就可以绘制面板。 public override void OnInspectorGUI() { //得到Test对象 var test = (BossBulletManager)target; test.bossBulletType = DrawList("", ThreeToOneManager.Inst.ListToEnum("/Resources/BossBullet/...
public class InspectorBase : Editor where T : UnityEngine.Object { protected T Target { get { return (T) target; } } } 现在,如果我想要为MyCustomComponent创造检查器,我就可以从InspectorBase得到检查器,然后使用“Target”,这样我就不用时常更改了。
To create the custom editor for the LookAtPoint script: Create a new C# script and name it “LookAtPointEditor”. Open the script and replace its contents with the code below. usingUnityEngine;usingUnityEditor;[CustomEditor(typeof(LookAtPoint))][CanEditMultipleObjects]publicclassLookAtPointEdito...