Smoke not visible (wrong side of camera)

I’m trying to add the particle system, but I cant get the smoke to be visable.
I’ve figured out why (I think) but not how to fix it.

the code works and the particles are there, but they are going away from the camera. (when I check in 3d i can see the smoke). If I change the z index to be minus more then the camera, it is visable, but as I get the positon or each smoke by the gameObject I cant change that (plus, it feels like the wrong way of doing it)

In 3d view:

any tips?

From the screenshot i think part if not all of the problem has to do with the Z position of all your game objects. The camera is looking down the Z axis or in the positive direction. The camera should have a negative Z position. All of your game elements (paddle/ball/colliders/bricks/particles) can be at zero and then the background with a positive Z position so it doesn’t interfere with anything at the zero Z position.

I’m having a similar problem. My camera is at Z -10 everything else is at Z 0 except the background at Z 1.

What I noticed is when I trigger the smoke the particles go in the direction of Z, swiftly passing behind the background image. They stay partially visible thanks to the background images alpha setting.

So, why is this happening?

I’ve worked around it but putting the smoke at -5 so it stays visible a little longer, but that’s a hack. I’d rather know why it’s going in the direction of Z.

Check this out @fatphil

http://answers.unity3d.com/questions/577288/particle-system-rendering-behind-sprites.html

Sorting Layer / Ordering Layer - check out the comments by ConkyBean.

This is quite a nice video too;
https://www.youtube.com/watch?v=d7McyujCHc4

Hope this is of use.

1 Like

Thanks @Rob that worked a treat. I’m still on 4.6 at the moment.

I did it like this:

  1. Create a new sorting layer called smokeLayer
  2. Added a line before the color setting like so:
    smokePuff.particleSystem.renderer.sortingLayerName = “smokeLayer”;
    smokePuff.particleSystem.startColor = GetComponent().color;

Phil

1 Like

Fantastic, glad you got it working as you wanted it. :slight_smile:

@fatphil would you mind sharing your code here? I’m facing the same issue and reading the Unity forums is sometimes like reading a foreign manuscript at this stage.

Thanks!

BTW - also using 4.6

Try this: Brick.cs
Look at the SmokePuff() method

Good luck :slight_smile:

1 Like

Got it working!

For anyone wishing to fix this same problem, first go into your background prefab and click the “Sorting Layer” under Sprite Renderer - add a new one called smokeLayer

You don’t have to change the default or anything like that - simply ADD it and leave it alone!

Then add the two additional lines of code into your smokePuff() in the Brick.cs code that @fatphil provided, and it should work like a charm!

1 Like

Privacy & Terms