比如经常在三方插件中看到如下在Inspector中的样式 这种对特别是要做编辑序列化数据脚本操作很友好,但是这个是如何实现呢?比如我们要创建一个保存序列化的npc基本数据,名字(Name),性别(Sex),年龄(Age),需求有了,下面就简单演示如何创建这类脚本. 1,创建元数据类脚本,在unity中添加如下脚本 using System.Collections; using System.Collections.Generic; using UnityEngine; public class
在扩展Unity的时候,往往会用到一些属性,这里将常用的列一下. 1.属性只读: #if UNITY_EDITOR using UnityEditor; #endif using UnityEngine; public class ReadOnlyAttribute : PropertyAttribute { } #if UNITY_EDITOR [CustomPropertyDrawer(typeof(ReadOnlyAttribute))] public class ReadOnlyDraw
在Unity开发游戏的时候,为了有一个更快更方便的工作流,我们往往会在Editor下开发一些方便实用的工具.在工具中,用到最多,最关键的就是按钮,它是工具的首席执行官.下面就用最简单的代码来演示添加一个自定义按钮到Inspector当中. 案例:指定坐标后克隆新物体到场景. 1. 在Unity Assets下创建”ObjectBuilderScript”脚本,添加代码: using UnityEngine; public class ObjectBuilderScript : MonoBeh
通过声明的变量名称,主动关联引用. 使用这个关联引用两种方式1. 给你组件继承 MonoAutoQuote 点击组件inspector 按钮执行2. 给你组件类添加[AAutoQuote] 特性 通过Plateface/SetSelectGameRef 执行 [AAutoQuote] public class MonoAutoQuote : MonoBehaviour ,IAutoQuote{} public interface IAutoQuote { } public class A
new a gameobject & overloaded methds var go1 = new UnityEngine.GameObject.ctor(); var go2 = new UnityEngine.GameObject.ctor$$String("Hello"); add/get c# component (UnityEngine.Transform.ctor); (UnityEngine.UI.Image.ctor); image.set_color(/,
原地址:http://www.cnblogs.com/realtimepixels/p/3652086.html Unity AssetBundle Dependencies In the last few weeks I’ve spent quite a lot of time with Unity’s Asset Bundle system. Understanding how dependencies were tracked. What determines GC cleanup of
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