Unity编辑器 - 使用GL绘制控件 控件较为复杂时,可能造成界面卡顿,在EditorGUI中也可以灵活使用GL绘制来提升性能. 以绘制线段为例: using UnityEngine; using UnityEditor; public class EditorGL { private static Material _sLineMat; static EditorGL() { Shader shader = Shader.Find("Hidden/Internal-Colored"
学习NGUI插件的时候,突然间有一个问题为什么它这些属性可以通过弹出窗口来选中呢? 而我自己写的组件只能使用手动拖放的方式=.=. Unity开发了组件Inspector视图扩展API,如果我们要写插件方便别人来使用,使用编辑器扩展API让我们的组件显示的更华丽,使用方便 Texture弹出选择框选中图片赋值: 1个组件对应1个Edit扩展器,继承Editor必须让入Editor文件夹下 MyComponent: using UnityEngine; using System.Collectio
原文地址:http://www.xuanyusong.com/archives/561 任何一个无规则曲线它都是有若干个线段组成,及时是圆形它也是又若干个线段组成的,也就是说将若干个线段拼接起来就是我们须要的无规则曲线-那么在3D 的世界中我们须要知道 X Y Z 三个点来确定一条3D线段. 首先先使用Unity编辑器的方式来添加一条线- Unity -> GameObject -> Create Empty 创建一个空的对象,我命名为line.然后点击 Component -> M
自定义检视面板的使用: 先是定义一个脚本文件,我们来修饰它的检视面板: [HelpURL("http://www.baidu.com")] public class Atr : MonoBehaviour { public int id; public string Name; [Multiline()] public string BackStory; public float health; public float damage; public float weaponDamag
http://blog.csdn.net/akof1314/article/details/38129031 假设有一个敌人生成器类,其中有个属性range用来表示敌人生成的范围区域大小,那么可以用OnDrawGizmos函数来绘制它在场景视图所代表的区域大小,便于开发调试.这个敌人生成器类,类似如下: 12345678910111213141516171819 using UnityEngine;using System.Collections; public class EnemySpa
脚本需挂在相机上,如果你的脚本,编辑器报错了,Matrix stack full depth reached,加上这个方法试试GL.LoadPixelMatrix(); using System.Collections; using System.Collections.Generic; using UnityEngine; public class GridLine : MonoBehaviour { public static bool isShowGridLine=false; publi
using UnityEngine; using System.Collections; public class TGLLine : MonoBehaviour { private static Material mat; void Start () { CreateLineMaterial(); } void Update () { } //画线框用的mat public static Material CreateLineMaterial(){ mat = new Material("Sh
本文转自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
https://www.xuanyusong.com/archives/category/unity/unity3deditor 1 using UnityEngine; public class Test : MonoBehaviour { public Rect rect; public Texture texture; } using UnityEngine; using UnityEditor; [CustomEditor(typeof(Test))] public class MyEd