x


Change color of Particles

Hi,

I am wondering why the below code is not changing the color of my particles:

public GameObject instRegularParticles ; public Color [] holder ; void OnParticleCollision (GameObject other) { Debug.Log("Particles Collided"); // happens

holder = new Color[5];
holder = instRegularParticles.GetComponent<ParticleAnimator>( ).colorAnimation;

// change the initial value of 255,255,255,255 to redish? holder[0].r = 155f; holder[0].g = 41f; holder[0].b = 48f; holder[0].a = 214f; // coppy?
instRegularParticles.GetComponent<ParticleAnimator>( ).colorAnimation = holder; }

This logic worked when I wanted to decrement (fade particles away), I am asking what I could be doing wrong? Or not using, rather?

more ▼

asked Jun 28 '10 at 12:44 AM

lampshade gravatar image

lampshade
391 84 92 109

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Color values are 0 through 1, not 0 through 255.

more ▼

answered Jun 28 '10 at 12:57 AM

Eric5h5 gravatar image

Eric5h5
80.1k 41 132 519

LOL! But how would I achieve a specific shade of "red"?

Jun 28 '10 at 01:13 AM lampshade

You can put in decimal values, i.e. .5f.

Jun 28 '10 at 01:28 AM Tetrad
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x636
x504

asked: Jun 28 '10 at 12:44 AM

Seen: 1066 times

Last Updated: Jun 28 '10 at 12:44 AM