美文网首页
Unity 和 FairyGUI 联合开发

Unity 和 FairyGUI 联合开发

作者: 安宇辛 | 来源:发表于2020-12-31 14:44 被阅读0次

    一:介绍

    Unity 是实时3D互动内容创作和运营平台 。包括游戏开发、美术、建筑、汽车设计、影视在内的所有创作者,借助Unity将创意变成现实。Unity平台提供一整套完善的软件解决方案  ,可用于创作、运营和变现任何实时互动的2D和3D内容,支持平台包括手机、平板电脑、PC、游戏主机、增强现实和虚拟现实设备。

    官网文档地址: https://docs.unity3d.com/2020.1/Documentation/Manual/index.html

    FairyGUI 是一个超强 UI 编辑器,跨平台开源 UI 解决方案

    官网文档地址:http://fairygui.com/guide/

    二:FairyGUI 部分

    1:设置项目配置  设置成unity

    二:unity 部分

    1:发布后的资源需要设置成sprite(2d and ui),不然会抛出纹理集异常

    2:安装fgui插件

    插件FairyGUI名字  ,我这边是通过Package Manager  进行安装的

    3:创建一个空节点 并挂载脚本

    4:导入UI包和显示界面(Main.cs)

    ```

    using UnityEngine;

    using FairyGUI;

    using System;

    using GameUI;

    public class Main : MonoBehaviour

    {

        // Start is called before the first frame update

        void Start()

        {

            StartLoading();

        }

        void StartLoading()

        {

            UIPackage.AddPackage("FGUI/Loading");

            GComponent view = UIPackage.CreateObject("Loading", "loading").asCom;

            GameUIBase control = (GameUIBase)view.displayObject.gameObject.AddComponent(Type.GetType("LoadingView"));

            if (null != control)

            {

                control.SetFGUI(view, "LoadingView");

            }

            view.MakeFullScreen();

            GRoot.inst.AddChild(view);

        }

        // Update is called once per frame

        void Update()

        {

        }

    }

    ```

    相关文章

      网友评论

          本文标题:Unity 和 FairyGUI 联合开发

          本文链接:https://www.haomeiwen.com/subject/xtegvktx.html