How to interact with an object? (character)

I’m trying to make it so that the player can left click with the mouse on a box collider and it will transition to another word. I know how to set it so that it will transition to the world when clicked but I do not know how to make it so the player can left click on the collider.

I believe what you are saying that you need to determine if the player is left clicking on an object in world space, correct me if I am wrong? To do this:

  1. Check if the left mouse button is pressed - Input.GetMouseButtonDown(0)
  2. Get the current screen position of the mouse - Input.mousePosition
  3. Get a ray pointing away from the camera through that point - Camera.ScreenPointToRay
  4. Use ray data to do a physics raycast- Physics.Raycast
  5. Check if the interactable object washit by the raycast
  6. transition logic