原文地址:http://va.lent.in/unity-make-your-lists-functional-with-reorderablelist/ This article is reproduced, the original address: http://va.lent.in/unity-make-your-lists-functional-with-reorderablelist/ In Unity 4.5 we got a nice (undocumented) built-i
Unity has some quirks about their inspector, so as a preface they are listed here: If you add a [Serializable] attribute to a class, Unity's Inspector will attempt to show all public fields inside that class. Any class extending Monobehaviour automat
1.首先定义一个需要控制数值的类,类中定义若干个变量 using UnityEngine;using System.Collections; using UnityEngine; using System.Collections; // This is not an editor script. public class MyPlayer : MonoBehaviour { public int Jump; void Update () { // Update logic here... } }
本文转自http://catlikecoding.com/unity/tutorials/editor/custom-list/ Custom List, displaying data your way In this Unity C# tutorial you will create a custom visualization for arrays and lists in the editor. You will learn to create a custom editor use S
在扩展Unity的时候,往往会用到一些属性,这里将常用的列一下. 1.属性只读: #if UNITY_EDITOR using UnityEditor; #endif using UnityEngine; public class ReadOnlyAttribute : PropertyAttribute { } #if UNITY_EDITOR [CustomPropertyDrawer(typeof(ReadOnlyAttribute))] public class ReadOnlyDraw
1. 继承Editor,重写OnInspectorGUI方法 Editor官方文档 需求 将TestClass中intData属性和stringData按指定格式显示. 实现 定义一个测试类TestClass,一个可序列化类DataClass [CreateAssetMenu] public class TestClass : ScriptableObject { [Range(, )] public int intData; public string stringData; public L
About these tips These tips are not all applicable to every project. They are based on my experience with projects with small teams from 3 to 20 people. There’s is a price for structure, re-usability, clarity, and so on — team size and project size d
编辑器控制特效播放 Unity的动画编辑器不能预览粒子系统的播放,为了方便预览特效,设想制作一个预览特效的工具,通常一个特效有三种组件: - Animation - Animator - ParticleSystem 其中Unity编辑器在编辑器模式下会控制粒子的播放,所以这里控制特效播放的功能只能在播放模式下使用. 代码 using UnityEngine; using UnityEditor; using System; public class EffctPlayBackWin : Edi
Unity编辑器 - 使用GL绘制控件 控件较为复杂时,可能造成界面卡顿,在EditorGUI中也可以灵活使用GL绘制来提升性能. 以绘制线段为例: using UnityEngine; using UnityEditor; public class EditorGL { private static Material _sLineMat; static EditorGL() { Shader shader = Shader.Find("Hidden/Internal-Colored"
Unity编辑器 - DragAndDrop拖拽控件 Unity编辑器的拖拽(DragAndDrop)在网上能找到的资料少,自己稍微研究了一下,写了个相对完整的案例,效果如下 代码: object dragData = "dragData"; Vector2 offset; Color col = new Color(1, 0, 0, 0.6f); Rect rect1 = new Rect(20, 10, 100, 20); Rect rect2 = new Rect(20, 60,