26 lines
679 B
C#
26 lines
679 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.XR.Interaction.Toolkit;
|
|
using UnityEngine.XR.Interaction.Toolkit.Interactors;
|
|
|
|
public class HideHandOnGrab : MonoBehaviour
|
|
{
|
|
|
|
[SerializeField] XRBaseInteractor interactor;
|
|
[SerializeField] GameObject handModel;
|
|
|
|
void OnEnable()
|
|
{
|
|
interactor.selectEntered.AddListener(_ => handModel.SetActive(false));
|
|
interactor.selectExited.AddListener(_ => handModel.SetActive(true));
|
|
}
|
|
|
|
void OnDisable()
|
|
{
|
|
interactor.selectEntered.RemoveAllListeners();
|
|
interactor.selectExited.RemoveAllListeners();
|
|
}
|
|
|
|
}
|