Search Unity

Particle Animator Color Animation array

Discussion in 'Editor & General Support' started by RockHound, Jun 1, 2006.

  1. RockHound

    RockHound

    Joined:
    Apr 14, 2006
    Posts:
    132
    How do the Color Animation elements [0..4] in the Paricle Animator component affect the shading of particles? It's difficult to figure it out from experimentation alone.

    Thanks!
     
  2. forestjohnson

    forestjohnson

    Joined:
    Oct 1, 2005
    Posts:
    1,370
    They affect the color of the particles at different times during thier lifespan. eg: the particle will be more or less color 0 when it is spawned, and color 4 when it reaches the end of it's lifespan. You can make the opacity on those colors 0 at 0 and 4 to make the particle fade in and out.
     
  3. bigbrainz_legacy

    bigbrainz_legacy

    Joined:
    Jul 15, 2005
    Posts:
    137
    Is there any way to control when and how fast the particle transitions among the various colors?
     
  4. forestjohnson

    forestjohnson

    Joined:
    Oct 1, 2005
    Posts:
    1,370
    you could set doesAnimateColor on the particle animator to be false and then do it your self with a script:

    Code (csharp):
    1.  
    2.  
    3. if(timer >= redTime) renderer.material.color = redColor;
    4. if(timer >= greenTime) renderer.material.color = greenColor;
    5. if(timer >= blueTime) renderer.material.color = blueColor;
    6.  
    7.  
     
  5. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
    I can't get the color to change using renderer.material.color. How can I change the colors of particles when I want??
     
  6. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    material.color updates the property named "_Color" in the shader. However, the built-in particle shaders use a property named "_TintColor". So the code would have to be:
    Code (csharp):
    1. renderer.material.SetColor( "_TintColor", mycolor );
     
  7. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
    That did not work for me, but it also did not produce any errors. All of my particles are white, unless I set up the 5 colors in the GUI and also set them to animate.

    Where did you even find that "_TintColor" term? I don't know where to access it in the manual.

    Thanks!
     
  8. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    One way is to look at the source of built-in shaders. I think one or two particle shaders can't be colorized (they don't have color in inspector either), because that wouldn't be possible on some older hardware.
     
  9. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
    I'm still pretty new to Unity...I am learning new features every day. Here's my situation:

    I like the "Default-Particle" material very well for the effect I want, but I want to animate its color as I please. I can find no way to access this. If I switch this to a different material, I also can't figure out how to find the "Default-Particle" material again. Perhaps there is some way to use the shaders that came in your folder for the effect I want, but I don't have enough knowledge yet to figure it out.

    Any advice that you can give me in regards to this is extremely appreciated!

    After a few days:
    I'll just assume what I want to do is impossible, then, and use a different, less appropriate effect. Here's hoping particle color becomes animatable in Unity 2.0. This seems like a weird omission to me...perhaps OTEE felt that the default particles wouldn't get used much, but they were perfect for the effect I am going for.
     
  10. ljcljcl

    ljcljcl

    Joined:
    Jan 21, 2010
    Posts:
    1
    maybe i got the same prob. i'm totally newbie here and to the unity though, just hope writing this post might help others stucked in this simple issue just like me.

    After choosing a material rather than 'default-particle', as shader is set as 'diffuse' in default state, change the shader to 'particle - somewhat', then color animation will properly work.