Search Unity

Scaling the particle system in UI?

Discussion in 'Scripting' started by lubwn, Nov 19, 2017.

  1. lubwn

    lubwn

    Joined:
    Mar 22, 2017
    Posts:
    8
    Hi, I found tens of threads but each for different version of unity. I am using 5.6.1f1 and find it to be hard to scale particle system which is embedded in UI canvas layer. Everything scales nicely, including sprites and texts and colliders, but not a particle system.

    I am making a snowglobe, front layers is basicly spriterenderer with snowglobe png attached and particle system which is "snowing" inside. It works just perfectly, except not on different resolutions but the main one. Shape attribute of particle system does not scale when changing resolution. I guess even particles does not but it is not an issue for me, shape attribute however is, becuase then snow particles are falling outside an object.

    I was thinking about handling the size of shape of particlesystem by code, is it possible?

    Can someone please provide detailed workaround how to solve this? And advice would be appreciated!
     

    Attached Files:

    • UI.png
      UI.png
      File size:
      137.8 KB
      Views:
      2,041
    • UI_2.png
      UI_2.png
      File size:
      120.9 KB
      Views:
      1,732
    Last edited: Nov 19, 2017
  2. lubwn

    lubwn

    Joined:
    Mar 22, 2017
    Posts:
    8
    Did not found actual proper solution, but solved an issue by scaling particle generator to be ultra small, setting start speed to be quite high, so the snow actually hit the collider and then "slips" slowly to the bottom, making a "snowing" effect. However I would still appreciate to have an ability to scale particle systems with the canvas as any other component.
     
  3. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    Zodd, SDBrander, adamiss5138 and 6 others like this.
  4. Deankovitch

    Deankovitch

    Joined:
    Sep 28, 2012
    Posts:
    31
    Hi lubwn, you can use my Canvas Particle Emitter asset to generate and render particles within Unity's UI Canvas System.
    You can design the particles from scratch and on the last release it now supports Shuriken Particles, rendering the standard Unity particles using the Canvas Renderer.

    Here is the link to the asset: http://u3d.as/uAX
     
    richardkettlewell likes this.
  5. mitaywalle

    mitaywalle

    Joined:
    Jul 1, 2013
    Posts:
    253
    Hello, everyone! Have some problems with damn scale. Particles are under Overlay-canvas and CanvasScaler setup is MatchWidthOrHeight, and factor is 1 (max match to height). In editor particles scales correct on different resolutions and GameView sizes. but in Android build change resolution make SOME of them just disappear. Strange that not all, but just few of them. In clean project problem doesn't appear in build, and ParticleSystem.Main.ScaleMode as Hierarchy and Local work correct for different resolutions. Tried simple BakeMesh() script from Unite Berlin 2018, UnityUIExtensions.UIParticleSystem and this one https://github.com/mob-sakai/ParticleEffectForUGUI , with different scaleModes. Strange that brakes only few of them. Someone, please, help ):
     
  6. Deankovitch

    Deankovitch

    Joined:
    Sep 28, 2012
    Posts:
    31
    Hi, can you post some images of this happening, please.
    Did you got same result using the Canvas Particle Emitter asset?
     
  7. mitaywalle

    mitaywalle

    Joined:
    Jul 1, 2013
    Posts:
    253
    Hello! is there any demo of Canvas Particle Emitter?
    Do it work in overlay canvas?
     
  8. Deankovitch

    Deankovitch

    Joined:
    Sep 28, 2012
    Posts:
    31
    Yes, it works in all canvas types and in all platforms.
    Here are some videos showing the plugin in action: