I have a gun barrel and I spawn a particle effect at the end of it when the gun fires. Everything’s OK when the gun isn’t moving, but if the player does move, the effect is spawned, but is offset from the barrel.
I have the effect in the scene and I use Instantiate() to create a copy of it. I then set the transforms like so:
effect.transform.parent = spawnPoint.transform;
effect.transform.localPosition = Vector3.zero;
Where ‘spawnPoint’ is the end of the barrel. I’ve stepped through the code and everything looks OK. This also effects anything else spawned from this point. E.g. bullets. They look like they’re firing from outside the gun when the player is moving.