当前位置:网站首页>FGUI工程打包发布&导入Unity&将UI显示出来的方式
FGUI工程打包发布&导入Unity&将UI显示出来的方式
2022-07-06 09:18:00 【SQ刘】
FGUI工程打包发布&导入Unity&将UI显示出来的方式
一、打包发布工程




二、Unity中运行显示UI的两种方式
前言:如果前面没有下载FairyGUI,可在资源商店里先下载好并导入。

(1)手动添加,无需代码



解决办法:


(2)代码控制显示


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using FairyGUI;
public class FGUITest001 : MonoBehaviour
{
void Start()
{
GRoot.inst.SetContentScaleFactor(800, 600); //初始化设置合适的比例(分辨率也就设置好了)
UIPackage.AddPackage("FGUI/Package1"); //加载打包好的项目
GComponent component = UIPackage.CreateObject("Package1", "Component1").asCom;
//加载对应的组件 通过.asCom(或as GComponent)类型转换将它转换为GComponent组件类型
GRoot.inst.AddChild(component); //把当前组件实例化到UI Panel(GRoot实际上是UI Panel)的下面
}
}
至此,全部完成。
边栏推荐
- Gateway 根据服务名路由失败,报错 Service Unavailable, status=503
- Whistle+switchyomega configure web proxy
- 编译原理:源程序的预处理及词法分析程序的设计与实现(含代码)
- Database course design: college educational administration management system (including code)
- [offer78]合并多个有序链表
- [offer29] sorted circular linked list
- Walk into WPF's drawing Bing Dwen Dwen
- 数据库课程设计:高校教务管理系统(含代码)
- Derivation of logistic regression theory
- Flink late data processing (3)
猜你喜欢

單片機藍牙無線燒錄

程序设计大作业:教务管理系统(C语言)

单片机蓝牙无线烧录

Stm32f1+bc20+mqtt+freertos system is connected to Alibaba cloud to transmit temperature and humidity and control LED lights

There is no red exclamation mark after SVN update

Basic operations of databases and tables ----- modifying data tables

JS regular expression basic knowledge learning

idea问题记录

Remember an experience of ECS being blown up by passwords - closing a small black house, changing passwords, and changing ports

Single chip Bluetooth wireless burning
随机推荐
FairyGUI人物状态弹窗
InnoDB dirty page refresh mechanism checkpoint in MySQL
JS regular expression basic knowledge learning
The service robots that have been hyped by capital and the Winter Olympics are not just a flash in the pan
关于Gateway中使用@Controller的问题
(3) Introduction to bioinformatics of R language - function, data Frame, simple DNA reading and analysis
Unity场景跳转及退出
[leetcode15] sum of three numbers
数据库课程设计:高校教务管理系统(含代码)
[leetcode19] delete the penultimate node in the linked list
Flink late data processing (3)
js 变量作用域和函数的学习笔记
PT OSC deadlock analysis
Knowledge summary of request
Redis cache update strategy, cache penetration, avalanche, breakdown problems
What is the maximum length of MySQL varchar field
MySQL time, time zone, auto fill 0
1041 Be Unique (20 point(s))(哈希:找第一个出现一次的数)
2022.2.12 resumption
MySQL時間、時區、自動填充0的問題