Disable or Enable All GameObjects in an Array in Unity - Easy Solution

setactive all gameobjects in an array at once

Unity, disable all gameobject in array, setactive all gameobjects in an array at once.

 The C# script :

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

public class DisableObject : MonoBehaviour
{
    public GameObject[] myObject;

     public void MyFunction()
    {
     
        for (int i = 0; i < myObject.Length; i++)
        {
            myObject[i].SetActive(false);
        }
       
    }
}

unity disable all objects in array désactiver un gameobject unity setactive unity unity lateupdate unity set active array get disable gameobject unity disable a script unity gameobject is active  unity disable all objects in array désactiver un gameobject unity setactive unity unity lateupdate unity set active array get disable gameobject unity