How to make a wall that disappears like Layers of fear ?

Hello, I would like to know how to make a trigger system that activates when the player looks at another place and then makes a wall disappear behind him.
Thank you! Thank you!

Like at 00:31.

For the example in the youtube video, you need 3 prefabs that are almost identical. A prefab wall, a prefab wall with a door, a prefab wall with a door that is bricked up. This makes them easily replaced/swapped out for other walls.

When the user goes into the room, there is a trigger. When the user exits the trigger (onTriggerExit), and is inside the room, then the wall can be swapped for the prefab of the door that is bricked up. Honestly, this is probably the most work, as you need to make sure they are indeed in the room - you don’t want to change prefabs if a user walks into the trigger but walks out the way they came (because that is still a trigger exit). So, you would need to check the room with (maybe) a raycast to the floor - and check the floor space.

The second wall change happens when new wall that was just swapped (door bricked up) comes in LOS to the user. There are a lot of examples out there for that - which is basically checking to see if the user is looking at a specific point. If the new wall is in LOS, the back wall is swapped for a new prefab of a wall with a door.

public class LookAt : MonoBehaviour
[SerializeField] GameObject target;
[SerializeField] float lookDelta = 0.8f; // 1.0f is directly looking at gameObject

    // Update is called once per frame
    void Update()
        Vector3 direction = (target.transform.position - transform.position).normalized;
        float dotProduct = Vector3.Dot(direction, transform.forward);

        if (dotProduct >= lookDelta)
            // Change wall

Example above is using a dot product to determine if an object is looking at another. A product of 1 is looking directly at it, -1 is looking completely away.