#Particle systems in baked prefabs

1 messages · Page 1 of 1 (latest)

rare dock
#

If I have a prefab that contains a particle system, what's the best way to get access to that system and modify it at runtime?

I'm not doing anything special to bake the prefab, just calling GetEntity in the baker. The particle system exists and works in the game, and there's obviously some sort of link to it from the prefab entity, but I can't figure out the syntax to get access to the particle system.

SystemAPI.Query<SystemAPI.ManagedAPI.UnityEngineComponent<ParticleSystem>>() works to find all the particle systems in the world, but I seem to only have read-only access to them. What I really want is the ability to modify a particle system that exists on a single known entity.

Using Entities 1.0.16 in Unity 2022.3.14f1

drowsy talon
#

it's an actual game object instance

#

so feel free to modify however you want

rare dock
#

Nothing I tried seemed to affect the actual in-game particle system so I assumed it was either ECS doing its read-only access thing or that I was modifying a prefab rather than the instance. I'll experiment some more.

#

Yep, I just forgot to use ParticleSystem.Clear() as well as ParticleSystem.Stop(). Is there a way to get a particle system from a single entity or do I need to just query everything and filter it?

drowsy talon
#

I had similiar setup

#

I would just pass some id/entity associated with particle sstem

#

from jobs

#

and then on main thread just get that system and emit all particles