Deactivating gameObjects in an Array

I’m writing a C# script that gathers all active gameObjects in the scene and deactivates them. (Long story, haha. The script will later allow for a few objects with certain tags to remain active with an if statement after the foreach statement.)

So far, I have successfully created the array of gameObjects, but my script for deactivating them is throwing this compiling error:

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

It’s worth noting the commented out print statement does work (when not a comment).

using UnityEngine;
using System.Collections;

public class ActiveClickedOn : MonoBehaviour {
	
	void ClickedOn () {
		GameObject[] allObjects = UnityEngine.Object.FindObjectsOfType<GameObject>() ;
		foreach(object go in allObjects) {
			go.SetActive(false);
			//print(go + " yay!");
		}
	}
}

Used the code to deactivate objects from this wiki. I’m using Unity 5.2.1f1 and would love any insights you have. Thank you!

You are treating the GameObjects as objects. This should fix it:

foreach(GameObject go in allObjects)