Unity编辑器篇(四)OnInspectorGUI

using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
[CustomEditor(typeof(S_Socket))] //需要显示在Inspector的脚本
public class S_EditorTest : Editor   //继承Editor类
{
    S_Socket s_Socket;
   public override void OnInspectorGUI()
    {
        s_Socket = (S_Socket)target; // 获取当前脚本数据
        GUILayout.Button("Button"+s_Socket.str);
    }
}

效果:

发布了26 篇原创文章 · 获赞 8 · 访问量 5789

猜你喜欢

转载自blog.csdn.net/LM514104/article/details/101365613
今日推荐