How can I get every other GameObject except for the one I'm using?

Suppose I have a script attached to a GameObject (let’s call it “my_object”). What I want to do is to call any other GameObject except for the one the script is attached to (in this case, my_object). It should be something like:

void Start () {
           GameObject [] objList = GameObject.Find ("Any other object except for this one"); 


How can I do that without putting “my_object” inside the array?

A gameobject has an InstanceID property that you can check on which is unique for each gameobject.

Make sure you’re using System.Linq;

GameObject[] gameObjects = Object.FindObjectsOfType<GameObject>().Where(f => f.GetInstanceID() != gameObject.GetInstanceID()).ToArray();