In Unity, this asset has the following component: Rigidbody, Mesh Collider, and the XR Grab Interactable.
As has been shown in this series of articles, the XR Grab Interactable is the component that is going to allow us to interact with the object in VR.
Add a Spotlight game object as a child to our Flashlight asset
Play around with the Spot Light settings in the Inspector
Flashlight Behaviour Script
Create a new script, named it FlashlightBehaviour, and added it to the Flashlight game object.
On Unity, drag the Spot Light from the Flashlight and place it on the field Flashlight Light OB.
Back to the Flashlight, locate the XR Grab Interactable component, locate Interactable Events and go down the many events list and find the Activate [Activated(ActivateEventArgs)]
Press the plus sign and drag the Flashlight object to the None (object) empty field. Press where it says No Function and locate the FlashlightBehaviour script.
Select ActivateFlashlight(), is the public method we created on the script.
By pressing the trigger, once you are holding the flashlight, you can turn it On or Off the flashlight.
🎮TO BE CONTINUED🎮