当前位置: 首页 > news >正文

做网站的网络公司厨师培训

做网站的网络公司,厨师培训,塔城市建设局网站,网站首页用什么字体好Unity中的UI工具包#xff08;UI Toolkit#xff09;不但可以用于创建编辑器UI#xff0c;同样可以来创建运行时UI。 关于Unity中的UI系统以及使用UI工具包创建编辑器UI可以参见#xff1a; 1. Unity中的UI系统 2. 初识UI Toolkit - 编辑器UI 本文将通过一个简单示例来…Unity中的UI工具包UI Toolkit不但可以用于创建编辑器UI同样可以来创建运行时UI。 关于Unity中的UI系统以及使用UI工具包创建编辑器UI可以参见 1. Unity中的UI系统 2. 初识UI Toolkit - 编辑器UI 本文将通过一个简单示例来介绍如何使用UI工具包来创建运行时UI。 一、创建UI Document.uxml 1. 使用任意模板新建一个Unity项目。 2. 在Project中右键点击Scene选择Create UI Toolkit UI Document命名为SimpleRuntimeUI。 3. 在Project里点击SimpleRuntimeUI右侧箭头展开后双击inlineStyle在文本编辑器里打开。并将文件内容替换为下面代码。 ui:UXML xmlns:uiUnityEngine.UIElements xmlns:uieUnityEditor.UIElements         xsihttp://www.w3.org/2001/XMLSchema-instance engineUnityEngine.UIElements editorUnityEditor.UIElements         noNamespaceSchemaLocation../UIElementsSchema/UIElements.xsd editor-extension-modeFalse     ui:VisualElement styleflex-grow: 1;         ui:Label textThis is a Label display-tooltip-when-elidedtrue/         ui:Button textThis is a Button display-tooltip-when-elidedtrue namebutton/         ui:Toggle labelDisplay the counter? nametoggle/         ui:TextField picking-modeIgnore labelText Field textfiller text nameinput-message /     /ui:VisualElement /ui:UXML 二、将UI Document与场景关联 1. 在场景中选择菜单GameObject UI Toolkit UI Document新建一个对象。在Hierarchy中选择UIDocument将Project中的SimpleRuntimeUI.uxml拖到Inspector中的Source Asset中。 三、创建MonoBehaviour脚本 1. 选择菜单Assets Create Scripting Monobehaviour Script创建脚本并命名为SimpleRuntimeUI.cs。 2. 双击SimpleRuntimeUI.cs打开后将内容替换为下面代码。 using UnityEngine; using UnityEngine.UIElements; public class SimpleRuntimeUI : MonoBehaviour {     private Button _button;     private Toggle _toggle;     private int _clickCount;     //Add logic that interacts with the UI controls in the OnEnable methods     private void OnEnable()     {         // The UXML is already instantiated by the UIDocument component         var uiDocument GetComponentUIDocument();         _button uiDocument.rootVisualElement.Q(button) as Button;         _toggle uiDocument.rootVisualElement.Q(toggle) as Toggle;         _button.RegisterCallbackClickEvent(PrintClickMessage);         var _inputFields uiDocument.rootVisualElement.Q(input-message);         _inputFields.RegisterCallbackChangeEventstring(InputMessage);     }     private void OnDisable()     {         _button.UnregisterCallbackClickEvent(PrintClickMessage);     }     private void PrintClickMessage(ClickEvent evt)     {         _clickCount;         Debug.Log(${button} was clicked!                  (_toggle.value ? Count:   _clickCount : ));     }     public static void InputMessage(ChangeEventstring evt)     {         Debug.Log(${evt.newValue} - {evt.target});     } } 3. 保存文件并返回Unity。在Hierarchy中选择UIDocument将Project中的SimpleRuntimeUI拖到Inspector的空白处给UIDocument添加脚本组件。 4. 点击“运行”在Game窗口中就可以看到如下UI。点击Button可以在控制台看到输出的消息。
http://www.tj-hxxt.cn/news/133380.html

相关文章:

  • cnetos 7 wordpress车辆优化管理专业网站
  • 近一周的热点新闻seo免费优化网址软件
  • 搜讯网站开发微信建微网站
  • 西安哪个公司做网站WordPress主题会包含木马吗
  • 湛江网站建设哪家优惠多网站文章要求
  • 免费网站建设免代码wordpress官方响应式主题
  • 网站开发 如何备案一小时学会网站建设
  • html 医药网站模板那里网站建设好
  • 外贸那些网站好用镇江网站制作教程
  • 南梁红色景区建设管理局网站做网站贵
  • 找网站开发项目秦皇岛海三建设一分公司
  • 如何对网站做镜像wordpress 默认相册
  • 做一个公司网站免费的网站推广
  • 性男女做视频网站网络推广和网络运营
  • 在国内可以做国外的网站吗海口最新新闻消息
  • 龙岗建设企业网站wordpress 内容 主题
  • 网站建设营销公司南京建设企业
  • 百度网站解封wordpress免费电子商务插件
  • 北京 网站建设托管公司网站 建设ppt模板
  • 如何对网站进行爬虫网站建设单子
  • 域名注册和网站建设兰州网站seo服务
  • 易语言可以建设网站吗石景山区百科seo
  • 网站让百度收录应该怎么做网址seo关键词
  • 德州中文网站建设成立公司需要哪些人员
  • 做爰片免费网站视频东莞网络优化公司
  • 做网站和推广公司扁平结构的网站
  • 网站备案登记查询系统免费软件有版权吗
  • 公众号怎么制作横屏长图文东莞网站排名优化seo
  • 网站的风格设计擦边球做网站挣钱
  • 网站内容管理后台系统怎么做企业建网站得多少钱