Triggers with this script need to spawn/despawn some objects at once

Hi, I’ve made a script that I use on triggers to spawn/despawn additional game elements when you walk in or out of it, depending on the settings you change in the Inspector.
But I’m not able to understand what’s wrong with my syntax.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SpawnSomeStuff : MonoBehaviour
{
	void Start()
	{
		this.audioDevice = base.GetComponent<global::UnityEngine.AudioSource>();
	}

    void Update()
    {
        arrayPosition = 0;
    }
	
	void OnTriggerEnter(Collider other)
	{
		if(!this.ignoreEnter & other.tag == "Player")
		{
			if(this.despawnOnEnter)
			{
				this.Objects.SetActive(false);
			}
			else
			{
				this.Objects.SetActive(true);
			}
		}
	}

	void OnTriggerExit(Collider other)
	{
		if(!this.ignoreExit & other.tag == "Player")
	    {
	    	if(this.spawnOnExit)
	    	{
	    		this.Objects.SetActive(true);
	    	}
	    	else
	    	{
	    		this.Objects.SetActive(false);
	    	}
	    }
	}

	public GameControllerScript gc;
	public bool despawnOnEnter;
	public bool spawnOnExit;
	public bool ignoreEnter;
	public bool ignoreExit;
	private AudioSource audioDevice;
	public static int arrayPosition = 0;

	public GameObject[] Objects;
}

I get errors saying

‘GameObject’ does not contain a definition for ‘SetActive’ and no accessible extension method ‘SetActive’ accepting a first argument of type ‘GameObject’ could be found (are you missing a using directive or an assembly reference?)

Help would be greatly appreciated!

You’re attempting to call SetActive on the array, not an individual gameobject.

Okay, but I don’t know what I’m supposed to call on the array so I can set the active attribute on every gameobject within.

You need to set the index of the array to the value you want. The SetActive documentation demonstrates this.

Thanks very much!