I have an object that I want to be able to turn on and off with an oculus controller, I have another script that works but uses two different buttons. Is there a way to do it with one button? Here is the code I tried it only turns it off.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using OVRTouchSample;
public class ScreenSwitch2 : MonoBehaviour
{
public GameObject SCREEN;
void Start() {
SCREEN.gameObject.SetActive(true);
if (OVRInput.Get(OVRInput.RawButton.Y)){
if (SCREEN != false) SCREEN.gameObject.SetActive(false);
}
}
void Update()
{
if (OVRInput.Get(OVRInput.RawButton.Y)){
if (SCREEN != true) SCREEN.gameObject.SetActive(true);
}
}
}