Hi.
Is there a way I can get an array of all the triggers in my scene?
Yes. This function allows to enumerate all colliders in scene, and then it’s need to check IsTrgger value:
using System.Collections.Generic;
public class Triggers : MonoBehaviour
{
private List<GameObject> objectsWithTriggers = new List<GameObject>();
void Start ()
{
Collider[] cols = FindObjectsOfType<Collider>();
foreach(Collider col in cols)
{
if(col.isTrigger)
{
objectsWithTriggers.Add(col.gameObject);
}
}
}
FindObjectsOfType() is slow! Keep it in mind.