Search Unity

problem to visualize a Particle System

Discussion in 'Scripting' started by josiperez, Jan 11, 2018.

  1. josiperez

    josiperez

    Joined:
    Jan 12, 2017
    Posts:
    32
    Hi,
    I write to the "Editor & General Support" without answer, then I'm decided try here.

    I tested 5 different Particle System in a separate project and they worked; then, I put them inside the real game, in the scene where they will be call.

    At each phase end, the goal is to show one effect and I'm not reaching this.
    I tried the syntax described here:
    1. public GameObject dustPuff;
    2. private ParticleSystem dustParticle;
    3. void WhateverFunction () {
      1. GameObject dustObject = Instantiate(dustPuff, this.transform.position, this.transform.rotation) as GameObject;
      2. dustParticle = dustObject.GetComponent<ParticleSystem>();
    4. }
    and the variable points to the effect, but I'am not getting the effect working, using the syntax described in the same link:
    1. var dustPrtcl = dustParticle.emission;
    2. dustPrtcl.enabled = true;

    Suggestions about what i'm doing wrong?
    Thanks in advance
     
  2. BubyMB

    BubyMB

    Joined:
    Jun 6, 2016
    Posts:
    140
    josiperez likes this.
  3. josiperez

    josiperez

    Joined:
    Jan 12, 2017
    Posts:
    32
    Thank you BubyMB.
    I already tried Play/Stop using:
    if (!stars.isEmitting) {
    stars.Play ();
    }
    I can see the effect in the tab Scene, but not when run in editor mode.
    Tried inside a routine and also inside Update to sure i'm not losting the effect in a frame.
    Suggestions?
     
  4. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,187
    If you select your particle in the hierarchy, you should have the option to test it in the scene view (a box will appear). If you play it, make sure you can see it. Make sure the size is correct and that nothing is blocking it. Particles can be blocked by gui stuff or if in the wrong sort order. Also remember particles are usually made of several pieces. Example, a fire with smoke and sparks might have several parts. So make sure these are all set to the right layer, size, etc.

    Also make sure your particle is on. I see you enabling emissions, but is the particle gameobject actually active. And if it's suppose to loop, turn that on.
     
    josiperez likes this.
  5. ihgyug

    ihgyug

    Joined:
    Aug 5, 2017
    Posts:
    194
    Check the Particle Render options, maybe the layer order isn't above a sprite and that sprite is hiding your effect.
     
    josiperez likes this.
  6. josiperez

    josiperez

    Joined:
    Jan 12, 2017
    Posts:
    32
    I had to solve another case, then, @Brathnann and @ihgyug, sorry for not thank you before.

    Now, I can see the firework in the sceneView.
    I had to transparency the background image to see the effect, even changing the "order in layer" to a number greater than the background image layer (just a navy blue to highlight the firework) in "Render" options. I tried also to create a new layer "fireworks". No success.

    The size is ok in the sceneView, but when running, it was very big.
    Now it is better - I changed:
    - in PS, "scaleMode" to "Hierarchy"
    - the scale (x,y,z) in the "Rect Tranform" where the particle is defined to 0.1
    - the star size from 800x800 to 100x100 pixels
    - the "size by speed" configuration in PS.

    About the hidden particle:
    In my hierarchy:
    betweenLevelCanvas layer UI
    betweenLevelButtons layer UI
    (includes a component "Image (script)" with "source image" none and color blue: if I let this color with "alpha" lower than 255 I can see the PS
    texts layer UI​
    fwStars layer fireworks
    (it is a Rect that includes a PS)

    In PS, "renderer":
    sorting layer fireworks
    order in layer 9

    considering if I see Layers (the first 7 are greyed by unity3D), I have:
    8 fireworks

    Any suggestion about the hidden particle?
    Thank you in advance
     
    Last edited: Mar 8, 2018