how to make a game where when you walk to a box it pops up questions

I’m trying to make a game with 5 islands you walk around freely but when you walk up to a box and press a certain button 5 questions will pop up I have finished the design of game the only thing that’s left for me is to do the questions, keep in mind this is the first game I ever tried to make, I have some knowledge in coding but not a lot I appreciate all the help I can get thank you

This is how I do this:

  1. Put a special GameObject on the box (i.e. make it a child of the box’s object) on a layer named ExamineLayer or something similar. Set that layer not to collide with anything, and give that object a collider. You can define layers in Edit → Project Settings → Tags and Layers, and adjust the collision matrix in Project Settings → Physics or Physics2D.

  2. Make a MonoBehaviour script called, say, ExamineTarget and put it on that special object. Define a public function called onExamine() or something similar.

  3. When the player pushes your Certain Button, do a Physics.Linecast or Physics2D.Linecast on ExamineLayer from the player’s character in a direction in front of the character. If it hits something, get the object it hit, use GetComponent to get your ExamineTarget script component from the object, and call your onExamine() function.

Google is your friend! You can google, for example, unity Physics2D.Linecast and google will bring you straight to unity’s documentation page for that function, I find this to be faster than using the documentation’s built-in search bar. I recommend reading up on the functions I highlighted, as well as going through unity’s tutorials, especially the scripting tutorials if you’re unfamiliar with C#. The live sessions are good too, if you have time to sit through an hour per video, they go in-depth on a lot of things but you can learn some good general-utility bits while they do it.

would it matter if the game is in 3D