Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Does Unity5 have native support to scale particle systems ?

Discussion in 'Unity 5 Pre-order Beta' started by TreasureMap, Jan 7, 2015.

  1. TreasureMap

    TreasureMap

    Joined:
    Apr 23, 2014
    Posts:
    14
    The only particle scaling solution I found was on the unity asset store.
    Particle Scaler by Roel Ezendam
    https://www.assetstore.unity3d.com/en/#!/content/4400


    Does Unity5 have native support to scale entire particle systems ?

    If so, can you point me to info on how to do it ?
     
  2. Vibs_appit

    Vibs_appit

    Joined:
    Feb 16, 2014
    Posts:
    53
    I don't know about native, but I use fxeditor by Jean Moreno (the cartoon fx fame). Then again, You could look at his code and build your custom fx editor yourself.
     
  3. TreasureMap

    TreasureMap

    Joined:
    Apr 23, 2014
    Posts:
    14
    Thanks for the info!
     
  4. RustyFlash

    RustyFlash

    Joined:
    Oct 8, 2014
    Posts:
    88
    For simple particle systems, I use this code,

    Code (CSharp):
    1.     public static void ScaleParticle( ParticleSystem particle, float scale)
    2.     {
    3.         particle.startSize *= scale;
    4.         particle.startSpeed *= scale;
    5.         particle.startRotation *= scale;
    6.         particle.transform.localScale *= scale;
    7.         particle.Stop();
    8.     }
    Just create the particle at a base resolution, and then calculate the scale factor based on the current resolution, etc.
     
  5. TreasureMap

    TreasureMap

    Joined:
    Apr 23, 2014
    Posts:
    14
    This is also very helpful. Thank you!
     
  6. RustyFlash

    RustyFlash

    Joined:
    Oct 8, 2014
    Posts:
    88
    One thing I should mention. When scaling a prefab, make sure it is on an instance of the prefab and not the prefab itself. For some reason, unity will retain the scale modification so that at every time this is called the particle will get bigger and bigger (or smaller depending on the scale factor). Yes, unlike a lot of modifications that can be made during play mode, this will permanently modify and non instanced prefab/particle.
     
  7. Vibs_appit

    Vibs_appit

    Joined:
    Feb 16, 2014
    Posts:
    53
    I thought you can't modify the prefabs at runtime... Now I am baffled..
     
  8. RustyFlash

    RustyFlash

    Joined:
    Oct 8, 2014
    Posts:
    88
    Trust me, they can be modified at runtime.

    If you add prefabs via a gameobject/particle system publicly in the inspector and then modify it directly using the scale script, the prefab itself with be permanently modified.

    Always work with instanced particle systems is my advice.
     
  9. VicToMeyeZR

    VicToMeyeZR

    Joined:
    Jun 3, 2012
    Posts:
    427
    Amazing realistic fire package has an FXScaler for the Editor. You add the script to the Particle and then adjust the slider
     
  10. RustyFlash

    RustyFlash

    Joined:
    Oct 8, 2014
    Posts:
    88
    I believe that only works in editor mode rather than being accessible during build though?

    I was under the impression that a solution was wanted to scale particles at run time?
     
  11. VicToMeyeZR

    VicToMeyeZR

    Joined:
    Jun 3, 2012
    Posts:
    427
    Not sure. He didn't specify. There is his options. :)
     
  12. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437
    But as far as I know, the answer is NO, Unity does not have native support for scaling particle systems.

    I remember reading a couple of posts in the threads the Unity devs were posting in which they were taking feedback from the community, and several people (myself included) mentioned this very problem as something they'd like to see addressed in the future.

    I hope the Unity devs implement a way to do this in the 5.x release cycle.