2 XRGrabInteractable scripts on one game object (parent, child), second grab interactable does not respond
Hi guys,
I'm facing strange issue with XRGrabInteractable script. I can only re-create this issue when building for Android (Oculus). Issue not met on Windows build. Problem - I have 2 XRGrabInteractable components on single gun object. One is attached to the gun handle collider (parent object), another one is attached to gun slider (to do manual gun pistol reload) on some child object. When starting android build, the XRGrabInteractable attached to the slider doesn't respond. I basically cannot move the slider. I figured out I have to disable and re-enable the XRGrabInteractable to get it working instantly.
Therefore I created the following nasty hack which works:
public class GrabInteractableHack : MonoBehaviour
{
private XRGrabInteractable _grabInteractable;
private void Awake()
{
_grabInteractable = GetComponent<XRGrabInteractable>();
_grabInteractable.enabled = false;
}
void Start()
{
_grabInteractable.enabled = true;
}
}
Not sure whether scripts execution order settings in Projects Settings / Script Execution Order would help. But anyway, I'm curious why this occurs.
Any idea welcome!
Your answer
Follow this Question
Related Questions
How to make pie menu options interact to OnMouseDown? 0 Answers
(Final IK) How can I change the Type of the Weight Curve of an Interaction Object from the script? 0 Answers
Check distance between items and player not working 0 Answers
My collisions won't work whenever I pick it up with the XR Toolkit 0 Answers
Unity 3D #C Nightvision does not want to switch on or off. 0 Answers