当前位置:网站首页>Unity making plug-ins

Unity making plug-ins

2022-07-06 20:13:00 LiPing122335

using System.Collections;
using System.Collections.Generic;

using UnityEditor;// Namespace
using UnityEngine;
using UnityEngine.UI;

// Inherit Editor

public class TextEdiot : Editor {
    [MenuItem("ChaJian/WangNeng")]

// Write a static method
    public static void Get()
    {
       // GameObject cube = Resources.Load<GameObject>("UI/Cube");
       // GameObject go = Instantiate(cube);
       // go.name = "Cube";
       // Debug.Log(" Plug in made successfully ");

Transform canvas1 = Resources.Load<Transform>("UI/Canvas");
        Transform kl = Instantiate(canvas1);
        kl.name = "Canvas";

        Image image = Resources.Load<Image>("UI/Image");
        Image m = Instantiate(image);
        //Transform canvas = GameObject.Find("Canvas").transform;
        m.transform.SetParent(kl, false);
        m.name = "Image";

        Transform EventSystem1 = Resources.Load<Transform>("UI/EventSystem");
        Transform ev = Instantiate(EventSystem1);
        ev.name = "EventSystem";

    }
}       

原网站

版权声明
本文为[LiPing122335]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202131232206075.html