- Home /
changing the color of particles using the legacy particle animator?
im following a tutorial made by the tornado twins on vtc.com. they are showing how to animate particles and change the color and everything. they are using an older version of unity so the particle animator didnt look the same for me as it did in the tutorial. i emailed them and they told me how to find the legacy particle animator, which looks like the one they used in the tutorial. when im using the legacy particle animator, it gives you 5 different colors you can choose to use within a single particle system. by default, all 5 colors are white, but on the screen they are shown as pink. when i change any or all of the 5 colors, they are still pink on the screen. i play my game and they are still pink. how do i get it to actually change the color of my particles?
Answer by clunk47 · Sep 29, 2013 at 03:00 AM
You need to have a ParticleAnimator attached, as well as assign a material to the ParticleRenderer Component in the inspector. When you go to choose your material, type in default and you should see a Default Particle material. Here is a simple example if you want to change the colors at runtime:
using System;
using UnityEngine;
public class Example : MonoBehaviour
{
Color[] colors;
void Awake()
{
colors = new Color[5]{Color.red, Color.green, Color.blue, Color.cyan, Color.white};
gameObject.GetComponent<ParticleAnimator>().colorAnimation = colors;
}
}
Answer by DaveA · Oct 16, 2012 at 12:47 AM
you probably need to assign a material to the particle renderer. Use a particle shader on that material too.