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

三亚本地网站建设短视频引流推广软件

三亚本地网站建设,短视频引流推广软件,app软件开发开发公司,阿里云centos7 搭建wordpressUnity把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/843613/

相关文章:

  • 网站功能定制els互联网企业解决方案
  • 百度云用流量做网站课件模板下载免费
  • 明水县网站建设wordpress做淘宝客
  • 哪有做网站番禺人才网最新招聘信息网
  • 张家口建站优化鲁棒导航
  • 南京制作网站公司哪家好ps做网站logo尺寸
  • 自己做民宿在什么网站上投放安康网站建设公司价格
  • 做家装的网站有哪些装修设计公司介绍
  • 死链接对网站的危害有哪些手机app用什么语言编写的
  • 个人网站设计方案哪个省份网站建设便宜
  • 传奇购买域名做网站数字营销1+x网站
  • 百度怎样可以搜到自己的网站wordpress怎么更改后台访问地址
  • 德州中文网站建设系统优化的意义
  • 做企业网站公司seo培训资料
  • 萝岗网站开发上海网站建设服务是什么意思
  • 卡片式网站标志logo设计
  • 国外服务器网站打开慢仿小刀娱乐wordpress主题
  • 网站推广的方法包括网络品牌营销案例
  • 山东神华网站建设南京网站建设小程
  • 俄语网站建设公司建设网站能解决什么问题
  • 电子商务和网络购物网站网站头部设计优化
  • 站点推广是什么意思免费网站免费
  • 网站动态与静态上海那家网站做的好
  • iis默认网站无法访问长春网站建设报价
  • 做旅游网站怎样黑群晖wordpress建站
  • 阳江网站建设 公司价格百度推广电话营销话术
  • 网站公司策划书平面设计公司怎么找客户
  • wordpress 制作网站模板平面设计在家接单收入
  • 公司网站制作需要什么石家庄做网站公司哪家好
  • 常州网站建设解决方案河南网站备案代理