<aside> 📄 This script causes an object to appear and dissapear when the player collides with an object. Attach the script to a parent object (e.g. an invisible cube) that has a box collider with “is trigger” checked. Make the object you want to appear a child of the parent and turn it off. Make sure the player is tagged Player. When the player makes contact with the parent object, the child will toggle on an off.

</aside>

using UnityEngine;

public class ShowHideObject : MonoBehaviour
{
    public GameObject objectToShowHide;

    private void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Player")) // Adjust the tag as needed
        {
            if (objectToShowHide != null)
            {
                objectToShowHide.SetActive(true);
            }
        }
    }

    private void OnTriggerExit(Collider other)
    {
        if (other.CompareTag("Player")) // Adjust the tag as needed
        {
            if (objectToShowHide != null)
            {
                objectToShowHide.SetActive(false);
            }
        }
    }
}