您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
35 行
868 B
35 行
868 B
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class SetRandomColor : MonoBehaviour {
|
|
|
|
public bool createDifferentMaterial = true;
|
|
|
|
// Use this for initialization
|
|
void Start ()
|
|
{
|
|
Animator[] objA = FindObjectsOfType<Animator>();
|
|
foreach (Animator o in objA)
|
|
{
|
|
float t = Random.value * 4.0f;
|
|
o.Update(t);
|
|
}
|
|
|
|
|
|
|
|
UnityEngine.Object[] obj = Object.FindObjectsOfType(typeof (UnityEngine.SkinnedMeshRenderer));
|
|
foreach (Object o in obj)
|
|
{
|
|
// go.material.color = ;
|
|
UnityEngine.SkinnedMeshRenderer r = (UnityEngine.SkinnedMeshRenderer)o;
|
|
r.material.SetColor("_BaseColor", Random.ColorHSV(0f, 1f, 1f, 1f, 0.5f, 1f));
|
|
}
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update () {
|
|
|
|
}
|
|
}
|