zoukankan      html  css  js  c++  java
  • unity meshrender理解

    网格渲染器,其中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;
    	}
    }
    
    
  • 相关阅读:
    每日总结
    每日总结
    每周总结
    全球覆盖(哈希+思维)
    DP搬运工2
    DP搬运工1 [来自yyy--mengbier的预设型dp]
    团队开发day06
    团队开发day05
    团队开发day04
    团队开发day03
  • 原文地址:https://www.cnblogs.com/yufenghou/p/5745827.html
Copyright © 2011-2022 走看看