Search Unity

how to change "color over lifetime" in C# script for particle effect

Discussion in 'Scripting' started by r2digi, Jul 30, 2014.

  1. r2digi

    r2digi

    Joined:
    Sep 26, 2013
    Posts:
    24
    how can i access the color over lifetime gradient for a particle system? we have a connect3 game that we have an effect we want to change the color based on the piece color it's attached too.....c

    we created a component with seven Gradients that an artist can configure, then want to be just able to swap them in for the Color Over Lifetime piece of a particle system.
     
  2. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,775
    It's not possible in the standard API, which is one of the biggest issues with Shuriken - many of its options simply don't exist on the scripting side.

    It IS apparently possible if you use Reflection and SerializedProperty; I don't recall how exactly, though. I just read that somewhere. Hopefully that's enough to point you in the right direction.
     
  3. r2digi

    r2digi

    Joined:
    Sep 26, 2013
    Posts:
    24
    thanks. we acutually in this case just use the gradient for alpha blending animation so was able to just set the start color and it worked for now....
     
  4. leonardherndon

    leonardherndon

    Joined:
    Sep 1, 2014
    Posts:
    2
    Can you elaborate on your solution r2digi? I know it's been a while, but I am having the same issue here
     
  5. Olly

    Olly

    Joined:
    Jun 19, 2014
    Posts:
    20
    I seem to be finding these limitations all over the unity engine.
     
  6. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,775
    This one was solved in 5.3, though. Check the date of the post you're replaying to before you necropost...
     
  7. wrench_nz

    wrench_nz

    Joined:
    May 13, 2014
    Posts:
    11
    I can only find JS example