当前位置:网站首页>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)的下面
}
}
至此,全部完成。
边栏推荐
- Redis based distributed ID generator
- 如何给Arduino项目添加音乐播放功能
- Intermediate use tutorial of postman [environment variables, test scripts, assertions, interface documents, etc.]
- Single chip Bluetooth wireless burning
- [Leetcode15]三数之和
- Affichage du changement de valeur du Buff de gain de l'interface graphique de défaillance
- Compilation principle: preprocessing of source program and design and implementation of lexical analysis program (including code)
- MySQL time, time zone, auto fill 0
- [899]有序队列
- 1041 be unique (20 points (s)) (hash: find the first number that occurs once)
猜你喜欢
Fabrication d'un sac à dos simple fairygui
Expected value (EV)
Vulnhub target: hacknos_ PLAYER V1.1
Fairygui gain buff value change display
Naive Bayesian theory derivation
Esp8266 connect onenet (old mqtt mode)
Redis based distributed ID generator
Office提示您的许可证不是正版弹框解决
idea中好用的快捷键
(5) Introduction to R language bioinformatics -- ORF and sequence analysis
随机推荐
js 变量作用域和函数的学习笔记
dosbox第一次使用
1081 rational sum (20 points) points add up to total points
FairyGUI简单背包的制作
FairyGUI增益BUFF數值改變的顯示
MySQL占用内存过大解决方案
InnoDB dirty page refresh mechanism checkpoint in MySQL
JS regular expression basic knowledge learning
Walk into WPF's drawing Bing Dwen Dwen
Lock wait timeout exceeded try restarting transaction
2022.2.12 resumption
Redis 缓存更新策略,缓存穿透、雪崩、击穿问题
Knowledge summary of request
Unity3D,阿里云服务器,平台配置
JS變量類型以及常用類型轉換
Fabrication of fairygui simple Backpack
How to add music playback function to Arduino project
In 2020, the average salary of IT industry exceeded 170000, ranking first
(4) Data visualization of R language -- matrix chart, histogram, pie chart, scatter chart, linear regression and strip chart
关于Gateway中使用@Controller的问题