using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ModelShine : MonoBehaviour
{文章来源:https://www.toymoban.com/news/detail-745489.html
//MeshRenderer组件
private MeshRenderer thisRenderer;
//创建一个常量接收时间变化值
public float shankeTime;
private void Start()
{
shankeTime = 0f;
thisRenderer = gameObject.GetComponent<MeshRenderer>();
}
// Update is called once per frame
void Update()
{
shankeTime += Time.deltaTime;
if (shankeTime % 1 > 0.5f)
{
thisRenderer.material.color = new Color(1, 0.5f, 0, 1);
}
else
{
thisRenderer.material.color = new Color(0, 0, 0, 1);
}
}
}文章来源地址https://www.toymoban.com/news/detail-745489.html
到了这里,关于unity通过代码动态改变模型颜色的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!