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

凉山建设机械网站wordpress 去除表格

凉山建设机械网站,wordpress 去除表格,网站后台ftp,凡科网建设网站如何修改源代码Unity把UGUI再World模式下显示到相机最前方 通过脚本修改Shader 再VR里有时候要把3D的UI显示到相机最前方,加个UI相机会坏事,可以通过修改unity_GUIZTestMode来解决。 测试用例 测试用例如下: 场景包含一个红色的盒子,一个UI…

Unity把UGUI再World模式下显示到相机最前方

通过脚本修改Shader

再VR里有时候要把3D的UI显示到相机最前方,加个UI相机会坏事,可以通过修改unity_GUIZTestMode来解决。

测试用例

测试用例如下:
在这里插入图片描述
场景包含一个红色的盒子,一个UI里含有这些元素
在这里插入图片描述

在这里插入图片描述
我们在UI根挂上运行脚本WorldSpaceOverlayUI.cs

脚本如下:

using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;[ExecuteInEditMode] //Disable if you don't care about previewing outside of play mode
public class WorldSpaceOverlayUI : MonoBehaviour
{private const string shaderTestMode = "unity_GUIZTestMode"; //The magic property we need to set[SerializeField] UnityEngine.Rendering.CompareFunction desiredUIComparison = UnityEngine.Rendering.CompareFunction.Always; //If you want to try out other effects[Tooltip("Set to blank to automatically populate from the child UI elements")][SerializeField] Graphic[] uiGraphicsToApplyTo;[Tooltip("Set to blank to automatically populate from the child UI elements")][SerializeField] TextMeshProUGUI[] uiTextsToApplyTo;//Allows us to reuse materialsprivate Dictionary<Material, Material> materialMappings = new Dictionary<Material, Material>();protected virtual void Start(){if (uiGraphicsToApplyTo.Length == 0){uiGraphicsToApplyTo = gameObject.GetComponentsInChildren<Graphic>();}if (uiTextsToApplyTo.Length == 0){uiTextsToApplyTo = gameObject.GetComponentsInChildren<TextMeshProUGUI>();}foreach (var graphic in uiGraphicsToApplyTo){Material material = graphic.materialForRendering;if (material == null){Debug.LogError($"{nameof(WorldSpaceOverlayUI)}: skipping target without material {graphic.name}.{graphic.GetType().Name}");continue;}if (!materialMappings.TryGetValue(material, out Material materialCopy)){materialCopy = new Material(material);materialMappings.Add(material, materialCopy);}materialCopy.SetInt(shaderTestMode, (int)desiredUIComparison);graphic.material = materialCopy;}foreach (var text in uiTextsToApplyTo){Material material = text.fontMaterial;if (material == null){Debug.LogError($"{nameof(WorldSpaceOverlayUI)}: skipping target without material {text.name}.{text.GetType().Name}");continue;}if (!materialMappings.TryGetValue(material, out Material materialCopy)){materialCopy = new Material(material);materialMappings.Add(material, materialCopy);}materialCopy.SetInt(shaderTestMode, (int)desiredUIComparison);text.fontMaterial = materialCopy;}}
}

在这里插入图片描述

引用
https://discussions.unity.com/t/world-space-canvas-on-top-of-everything/128165/14

http://www.yayakq.cn/news/479080/

相关文章:

  • 微信公众号优惠劵网站怎么做的新品发布会ppt参考
  • 建立内部网站做谷歌推广比较好的公司
  • 深圳网站建设黄浦网络没有备案的交易网站
  • 网站建设中 显示 虚拟机刚做网站做多用户还是单用户
  • 外国人做汉字网站郑州seo培训
  • 个人建网站首选什么域名好雪玫瑰制作教程来了
  • 房产中介网站模板wordpress软件下载源码
  • 新奇网站建设郑州本地seo顾问
  • 三水网站设计网站数据统计工具
  • 一站式建站价格怎么做网站表白
  • 17网站一起做网店潮汕档口网站建设市场行情报价
  • 网站效果代码优化设计英语
  • 漂亮企业网站百度地图导航2021最新版
  • 盛泽做网站的郑州市城乡建设规划网站
  • 网站登录失败怎么回事自己编程做网站
  • 购物网站网页设计模板江西建设工程信息网
  • 给女朋友做网站厦门seo优化推广
  • 重庆教育建设集团有限公司官方网站建立企业网站的好处
  • 网站批量收录简单个人网页模板
  • 制作小程序代码seoheuni
  • 淘宝网站开发的多少钱制作网页的网站叫什么
  • 长春公司建站模板国外家居创意空间设计
  • 苏州做网站找哪家好自己创建网页
  • php做视频分享网站在百度上做广告推广要多少钱
  • 网站点击量与排名wordpress xml 导入失败
  • html网站开发实战wordpress 视频无广告
  • sever2012 网站建设保定网站建设方案优化
  • 贵州省住房和城乡建设部官方网站保卫处网站建设
  • 学校网站建设宗旨环球贸易网的服务内容
  • 空间商网站ip被攻击后换ip首饰网站建设