ParticleAnimator.colorAnimation 颜色动画

var autodestruct : bool

Description描述

Colors the particles will cycle through over their lifetime.

粒子的色彩将会随着它们的生命周期循环。

Currently you cannot directly modify a single index of this array. Instead, you need to grab the entire array, modify it, and assign it back to the Particle Animator.

当前你不能直接修改这个数组的索引。相反的,你需要取回整个数组,修改它,然后将它赋回粒子动画。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void Start() {
		ParticleAnimator particleAnimator = GetComponent();
		Color[] modifiedColors = particleAnimator.colorAnimation;
		modifiedColors[2] = Color.yellow;
		particleAnimator.colorAnimation = modifiedColors;
	}
}
// How to properly change colorAnimation Colors via scripting
// 如何通过脚本正确的修改colorAnimation中的颜色
// Attach this script to a GameObject that contains a complete Particle System
// 将这个脚本附加到一个包含完整的粒子系统的GameObject上

function Start () {
	var particleAnimator : ParticleAnimator = GetComponent(ParticleAnimator);
	var modifiedColors : Color[] = particleAnimator.colorAnimation;
	modifiedColors[2] = Color.yellow;
	particleAnimator.colorAnimation = modifiedColors;
}
Page last updated: 2011-1-19