当前位置:网站首页>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)的下面
}
}
至此,全部完成。
边栏推荐
- 2021.11.10汇编考试
- Single chip Bluetooth wireless burning
- @The difference between Autowired and @resource
- Mysqldump error1066 error solution
- Latex learning
- The dolphin scheduler remotely executes shell scripts through the expect command
- [899]有序队列
- Design and implementation of general interface open platform - (39) simple and crude implementation of API services
- [offer78]合并多个有序链表
- 2021.11.10 compilation examination
猜你喜欢
Single chip Bluetooth wireless burning
(core focus of software engineering review) Chapter V detailed design exercises
Stm32f1+bc20+mqtt+freertos system is connected to Alibaba cloud to transmit temperature and humidity and control LED lights
First use of dosbox
Particle system for introduction to unity3d Foundation (attribute introduction + case production of flame particle system)
js 变量作用域和函数的学习笔记
Classification, understanding and application of common methods of JS array
编译原理:源程序的预处理及词法分析程序的设计与实现(含代码)
Database course design: college educational administration management system (including code)
NRF24L01 troubleshooting
随机推荐
Teach you to release a DeNO module hand in hand
Detailed explanation of truncate usage
PR 2021 quick start tutorial, first understanding the Premiere Pro working interface
Unity scene jump and exit
FairyGUI摇杆
Redis based distributed ID generator
Walk into WPF's drawing Bing Dwen Dwen
[899]有序队列
(三)R语言的生物信息学入门——Function, data.frame, 简单DNA读取与分析
Introduction to the daily practice column of the Blue Bridge Cup
Unity3d makes the registration login interface and realizes the scene jump
Minio file download problem - inputstream:closed
JS regular expression basic knowledge learning
ESP8266连接onenet(旧版MQTT方式)
[offer18] delete the node of the linked list
Page performance optimization of video scene
In 2020, the average salary of IT industry exceeded 170000, ranking first
Knowledge summary of request
Unity3D摄像机,键盘控制前后左右上下移动,鼠标控制旋转、放缩
Unity3D基础入门之粒子系统(属性介绍+火焰粒子系统案例制作)