unity meshrender理解
2016-08-07 11:38
405 查看
网格渲染器,其中unity里面多有的材质在渲染的时候都是会划分成三角形的,所以当添加一些物体的时候,例如3d text的时候,默认添加网格渲染器。
最常用的就是获取材质。
下面是一个利用网格渲染器获得材质,设置不透明度的例子。
using UnityEngine; using System.Collections; // Simple class for blinking the visibility of an item on and off [RequireComponent(typeof(Renderer))] public class BlinkAnim : MonoBehaviour { public float blinkTime = 0.6f; void Update() { // blink the item on and off using the material alpha. // use realtimeSinceStartup because Time.time doesn't increase when the game is paused. bool showTapToStart = Mathf.Repeat(Time.realtimeSinceStartup, 3*blinkTime) > blinkTime; Color col = GetComponent<Renderer>().material.color; col.a = showTapToStart ? 1.0f : 0.0f; GetComponent<Renderer>().material.color = col; } }
相关文章推荐
- Unity MeshRender中material和sharedmaterial的区别
- unity换装,SkinnedMeshRender
- Unity---------Mesh理解
- 全面理解Unity加载和内存管理机制之二:进一步深入和细节
- unity各种报错之:Mesh.colors is out of bounds. The supplied array needs ...
- Unity 创建一个扇形Mesh
- 理解 Unity3D RenderWithShader Api
- Mesh属性[Unity]
- unity中多套uv set理解和应用
- unity 增加顶点数,熟悉mesh的构成
- Unity 5.x: SubMesh + 多材质 的使用方式
- error CS1061: Type `UnityEngine.Mesh' does not contain a definition for `GetTriangleStrip' and no ex
- 【转】深刻理解render 和 redirect_to
- Unity教程之-合并(Combine)引用相同材质球的网格(Mesh)
- 关于Unity 获得和使用GetComponent<MeshFilter>().mesh时的心得
- [unity基础教程]全面理解Unity加载和内存管理
- Unity SpriteRender 支持Tile平铺的Shader
- 全面理解Unity加载和内存管理
- Unity 对象池(Object Pooling)理解与简单应用
- 关于unity中BindChannels的理解