How to make object come back

Ok so I have a trigger that gets its renderer shut off when it is collected, but I don’t know how to make it come back on when a different collectible is collected. How would I fix this?

void OnTriggerEnter(Collider other)
{
    //green
    if (other.gameObject.tag == "GreenCube")
    {
        other.gameObject.GetComponent<Renderer>().enabled = false;
        isGreen = true;
        ChangeColor();
    }
    //red
    if (other.gameObject.tag == "RedCube")
    {
        other.gameObject.GetComponent<Renderer>().enabled = false;
        isRed = true;
        ChangeColor();
    }
}

You are turning the renderer off but you aren’t deleting the gameobject. You should be able to just call gameObject.GetComponent<Renderer>.enabled = true. Note that disabling the renderer will not disable the trigger with the object, just will make it invisible to the camera.

From your snippet it looks like this script is interacting with some collectible objects, and that you want to re-enable them when some outside event happens, like a special collectible is found. If this is the case, an easy way to accomplish this is to add a script to each collectible:

public class CollectibleScript : Monobehavior{
    private static List<Renderer> renderers;

    void Start(){
        if(renderers == null) renderers = new List<Renderer>(); 
        renderes.add(GetComponent<Renderer>());
    }

    public static EnableAllRenderers(){
        foreach(Renderer r in renderers){
             r.enabled = true;
        }
    }
}

And then when you want to enable the renderers you can simply call CollectibleScript.EnableAllRenderers();

Youncan make a public var on both cubes and drag drop the other ones in it to be able to access them.