I’ve been attaching prefabs with a particle component to game objects with the ParticleSystem and instantiating that for death explosions. That has worked fine up until I started using DOTween, and if I have a tween onCallback to a death explosion where the prefab has type ParticleSystem, it will give me a casting error. If it has GameObject type, then I’ll get no error. This makes me think maybe I shouldn’t be using the ParticleSystem type for this sort of thing?
Just use your
prefab.gameObject
property to pass to that plugin. With prefabs, you may reference the prefab itself as GameObject or any component of it by it’s type, like ParticleSystem. In the second case you can always get the direct prefab reference from it’s component using .gameObject property