您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
20 行
542 B
20 行
542 B
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace BoatAttack
|
|
{
|
|
/// <summary>
|
|
/// Simple scripts sets a random HUE on a shader with the property '_Hue'
|
|
/// </summary>
|
|
public class RandomHue : MonoBehaviour
|
|
{
|
|
void OnValidate()
|
|
{
|
|
float hue = Random.Range(0f, 1f);
|
|
MaterialPropertyBlock mtb = new MaterialPropertyBlock();
|
|
mtb.SetFloat("_Hue", hue);
|
|
GetComponent<MeshRenderer>().SetPropertyBlock(mtb);
|
|
}
|
|
}
|
|
}
|