Prefab generated from position of XR grab interactable lag/delay

Thanks in advance for taking the time to read this.

Problem: I have a XR grab interactable ‘Gun’ with script attached to generate bullet & muzzleflash prefab, when shooting while strafing/moving player the bullet & muzzleflash prefab lags/appears in previous position not current (video attached). You can also see there is no issue generating these prefabs when stationary.

Vr device: Oculus Quest 2

Unity Version: 2020.1.9f1

Package: XR Interaction Toolkit 0.10.0

PlayerMovement Component: Continuous Move Provider (device based)

Weapon has XR grab interactable component & weapon script with>

private void Awake()
   {
       interactable = GetComponent<XRGrabInteractable>();
   }
   private void OnEnable()
   {
       interactable.onActivate.AddListener(Fire);
   }

   private void OnDisable()
   {
       interactable.onActivate.RemoveListener(Fire);
     
   }
   private void Fire(XRBaseInteractor interactor)
   {
       CreateProjectile();
   }

   private void CreateProjectile()
   {
   
       GameObject projectileObject = Instantiate(projectilePrefab,   
   barrel.position, barrel.rotation);
       Projectile projectile = projectileObject.GetComponent<Projectile>();
       projectile.Launch();
       GameObject muzzleFlashObject = Instantiate(muzzleFlashPrefab,
   barrel.position, barrel.rotation);
       Destroy(muzzleFlashObject, destroyTimer);
    }

Troubleshooting>

1.I have tried using <on Select Entered (XRbaseInteractor)> to assign the gun object as a child of the hand object.

2.Project Setting>Time>Fixed Timestep: tried 0.01388889 thru 0.0111111

3.Tried changing xr grab interactable components for smooth position/rotations & tried all 3 movement types.

  1. Used Object Pooling method instead of instantiation.

  2. Tried assigning the muzzlePrefab as a child of the barrel location and just enabling and disabling.

What happens when you do it in the Update method of the Gun? I have something similar and do not see any issue on 0.10 on Windows.

Disclaimer: I don’t know anything about Unity

I tried in Update & FixedUpdate no change. I also tried making the muzzle prefab a child of the gun object and just enabling/disabling and there is still delay in the position.

Please report this bug using Help > Report a Bug in Unity. The next upcoming version of XR Interaction Toolkit (1.0.0-pre.3) did some work to address this by making the Rig locomotion occur earlier in the frame. With the gun set as Instantaneous, it should make the position of it update every frame during Update. If the muzzle flash prefab does not have any delay and it doesn’t use the Physics timestep for updates, it should hopefully be resolved in the next version.