Array of Anchor Prefabs not working.
Im working on a simple script that deactivates and reactivates certain gameobjects spawned with the Anchor Prefab Spawner. I put tags on the prefabs and am referencing them through that and placing them in an array. bellow is my code.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PTToggle : MonoBehaviour
{
public GameObject[] ptWalls;
// Start is called before the first frame update
void Start()
{
ptWalls = GameObject.FindGameObjectsWithTag("pt remove");
}
// Update is called once per frame
void Update()
{
for (int i = 0; i < ptWalls.Length; i++)
{
if (OVRInput.Get(OVRInput.RawButton.RIndexTrigger))
{
ptWalls[i].SetActive(false);
}
if (OVRInput.Get(OVRInput.RawButton.LIndexTrigger))
{
ptWalls[i].SetActive(true);
}
}
}
}
This script works fine when running on desktop but when I deploy to Quest 3 it wont. Whats really confusing me is if I move the
ptWalls = GameObject.FindGameObjectsWithTag("pt remove");
into the update function Im able to deactivate the objects but not reactivate them. This leads me to believe the controller input is being recognized and this has something to do with how the array is being made at the start.
Any insight would be super helpful so thanks in advance!
