I am trying to create muzzle flash but whatever I do the particles system still doesn’t stick properly to the gun, eg. i run and the particles go behind the gun, i turn and it takes time for them to meet up with the barrel. I tried unchecking simulate in worldspace for the emitter, I tried parenting the object. I’m clueless.
Instantiate(muzzleFlash, barrelEnd.transform.position, barrelEnd.transform.rotation); barrelEnd.transform.parent = gameObject.transform;
You aren’t parenting the particles you are parenting the transform where the particles are created. Try this
GameObject particles = Instantiate(muzzleFlash, barrelEnd.transform.position, barrelEnd.transform.rotation) as GameObject;
particles.transform.parent = gameobject.transform;
I would also parent the particles to the barrelEnd instead of the gun itself