How can I enable an object from a script?

Basically i want object1 to be able to make object2 .enabled = true(object2 starts out with .enabled = false).

I’ve tried setting the game object to a variable with GameObject.Find(“object2”), but when I set it to enabled = true in a OnTriggerEnter function object2 and its scripts aren’t activated in the scene.

Use GameObject.SetActive(). (See Activating GameObjects.)

var object2 = GameObject.Find("object2");
if (object2 == null) {
    Debug.LogError("object2 not found");
} else {

The enabled property on behaviours (scripts) only affects the script, not the GameObject itself.