Simple Particle System

Hi yall

Any suggestions on a simple system for efx?
Shoot canister, explodes = play particle

Is it best to have a prefab object load that auto plays the particle system inside it, or attach the script on the collider for object? That is what I have been doing for collision sounds, calling to a child after the collision box that plays on void update. But I can’t find a line that calls for the particle on collision.

Thank you

I wouldn’t worry so much about “best” at this point. There’s like ten billion youtube tutorial out there for “something happens in game, make a particle system appear”

Just get it working first.

Also, ParticleSystems (particlesystems): emitting in various positions in space (no play / stop):

https://discussions.unity.com/t/849603/4

1 Like

Yes thank you for the reply
I have looked at some videos on youtube, but they seem to be going around a long process to do a simple task . I am attempting to have less code callings, meaning I don’t want to have a system that needs 2 script mentions for it to run, for cpu speed on the mobile so was looking for a system that didn’t relay on a load of loops or calls. Anytime a app has to run multi lines of code for one re-occuring task that is used often usually leads to a slowdown on lower end cell phones in some countries according to my stats on gpu performance grabs.

Ideally, a void Update if (Input.GetButtonDown(“Submit”));
run effect command but can’t seem to find the call for a particle system to refer. I placed a public notation to explain what said efx is referring too, but not sure what the call line should be after the(Input.GetButtonDown(“Submit”));
So my thought was make a gameobject then place efx in that, then call it via the script so it awakes on Submit - then plays effect - stops after its duration.

I will check out that thread you posted, thank you Kurt

Nope. That’s not a thing. I know you want it to be a thing, a simplistic mapping of “more lines more slow” but that’s NOT how the world works. Get it out of your mind before you seriously impair your ability to reason about engineering problems.

DO NOT OPTIMIZE “JUST BECAUSE…” If you don’t have a problem, DO NOT OPTIMIZE!

If you DO have a problem, there is only ONE way to find out. Always start by using the profiler:

Window → Analysis → Profiler

Failure to use the profiler first means you’re just guessing, making a mess of your code for no good reason.

Not only that but performance on platform A will likely be completely different than platform B. Test on the platform(s) that you care about, and test to the extent that it is worth your effort, and no more.

https://discussions.unity.com/t/841163/2

Remember that optimized code is ALWAYS harder to work with and more brittle, making subsequent feature development difficult or impossible, or incurring massive technical debt on future development.

Notes on optimizing UnityEngine.UI setups:

https://discussions.unity.com/t/846847/2

At a minimum you want to clearly understand what performance issues you are having:

  • running too slowly?
  • loading too slowly?
  • using too much runtime memory?
  • final bundle too large?
  • too much network traffic?
  • something else?

If you are unable to engage the profiler, then your next solution is gross guessing changes, such as “reimport all textures as 32x32 tiny textures” or “replace some complex 3D objects with cubes/capsules” to try and figure out what is bogging you down.

Each experiment you do may give you intel about what is causing the performance issue that you identified. More importantly let you eliminate candidates for optimization. For instance if you swap out your biggest textures with 32x32 stamps and you STILL have a problem, you may be able to eliminate textures as an issue and move onto something else.

This sort of speculative optimization assumes you’re properly using source control so it takes one click to revert to the way your project was before if there is no improvement, while carefully making notes about what you have tried and more importantly what results it has had.

Hi Kurt

Thank you for the reply
I was able to write a 3 line code and it works.

Much appreciated,
Sean