How to make an animated object disappear?

Hello,
I’m very new in Unity,just started exploring bits here and there.
I’m trying to make an object that disappears after it has finished animating.
Okay,here is the scenario:
An inanimate object(lets say a cube) is collided with another object,it then animates in a certain way,after it finishes the animation it disappears.
How to do that?
I’v so far only stumble upon these renderable thingy,i think i have to make the animated cube invisible,while the station cube visible,when the visible cube is triggered or touched it becomes invisible or renderable=false and the animated cube visible(renderable=true).
But after it animates how to make it disappear?
Thank you for the help

You could deactivate the object with SetActive:

gameObject.SetActive(false);

This is better than just setting renderer.enabled to false, because all components (colliders, scripts etc.) and children of this object are deactivated as well - you’ll not have problems with an invisible object haunting the scene.

This depends on your desired behaviour. If you want it to be invisible but still interact with your scene, set renderer.enabled to false. If you want it gone completely, call Destroy(gameObject). If you want to disable it to re-enable it later, use gameObject.SetActive(false), or if it has children, gameObject.SetActiveRecursively(false).