- Home /
Question by
ZeroLab · May 04 at 02:04 PM ·
vrgameenable and disable scriptontrigger
Hi im pretty new to unity and im using normcore as my ntworking for my vr game and i want to make a script that enables and disables the vr player
someone gave me this but i dont know how to use it
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class ScriptOnTrigger : MonoBehaviour {
public MyScript _myScript;
void OnTriggerEnter(Collision other)
{
if (other.gameObject.tag == "Player")
{
other.GetComponent<_myScript>().SetActive(true);
}
}
void OnTriggerExit(Collision other)
{
if (other.gameObject.tag == "Player")
{
other.GetComponent<_myScript>().SetActive(false);
}
}
}
Comment