Unity 编辑器开发实战【Create Editor】- RectTransformEditor拓展 Auto Anchors

        通过Editor类中的CreateEditor方法可以实现在不改变原有编辑器布局的情况下进行拓展,下面以RectTransform组件的编辑器为例:             如图所示,我们在不改变RectTransform原有编辑器布局的情况下,添加了一个Auto Anchors功能,该功能方便我们在搭建UI时自动设置锚点。 
        原有的编辑器布局通过CreateEditor方法来创建一个编辑器类,在OnInspectorGUI中调用其OnInspectorGUI方法即可,同时需要在OnSceneGUI中调用其OnSceneGUI方法:
using UnityEngine;
using UnityEditor;

using System.Linq;
using System.Reflection;

namespace SK.Framework
{
[CustomEditor(typeof(RectTransform)), CanEditMultipleObjects]
public seale

Unity 编辑器开发实战【Create Editor】- RectTransformEditor拓展 Auto Anchors最先出现在Python成神之路

版权声明:
作者:lichengxin
链接:https://www.techfm.club/p/21353.html
来源:TechFM
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>