Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Scripting particle color and size in v5.3

Discussion in 'Scripting' started by nasos_333, Jan 2, 2016.

  1. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    12,918
    Hi,

    I get a warning in my particle size and color scripting that is now deprecated (particles size and color) and startColor or GetColor() should be used instead.

    Is there a way in v5.3 to script particle color and size like in previous versions and if there is which is the equivalent of the size and color properties ?

    Thanks

    EDIT: The color/size refer to the individual color / size of each particle when grab them with GetParticles method and iterate through the structure.

    e.g.
    Code (csharp):
    1. Particle[i].color
    2. or
    3. Particle[i].size
    where "i" is the iterator running through the particle count of the overall system.
     
    Last edited: Jan 2, 2016
  2. hpjohn

    hpjohn

    Joined:
    Aug 14, 2012
    Posts:
    2,190
  3. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    12,918
    I use get particles first, i mean the color/size for each particle (not the global setting in the particle system)

    e.g.
    Code (csharp):
    1. Particle[i].color
    2. or
    3. Particle[i].size
    where "i" is the iterator running through the particle count of the overall system.

    EDIT: I updated the OP so it is more clear what the question refers to.
     
  4. ZannaU

    ZannaU

    Joined:
    Mar 24, 2013
    Posts:
    17
    +1 on this issue.

    I'm getting warning but I don't see an alternative API to set the values of color and size on 5.3.3.

    It's kind of weird that Unity deprecated this API without adding a different way to achieve the same result.
     
  5. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    12,918
    From my tests probably they condensed everything in the startsize / startcolor, so i use those instead. Seems they are no longer start size and color, but the current size and color (which act as start size/color at time zero i guess)

    The naming got strange i guess though, since the variable suggest another thing than what is now used for
     
  6. landon912

    landon912

    Joined:
    Nov 8, 2011
    Posts:
    1,579
  7. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    12,918
  8. HMiri

    HMiri

    Joined:
    Sep 4, 2017
    Posts:
    3
    I am confused by the new particle system API. It seems like the color and size properties can no longer be manipulated for individual points/particles. How would I re-write myArray.color = new Color(x, 0f, 0f) or myArray.startSize = 0.1f or Color c = myArray.color; c.g = p.y; myArray.color = c for example?