Scene switch when click on a game objekt

Hey, how can I switch my scene if i click on a game objekt. With my script it works but if i dont click on the game objekt it also swich scenes.

using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;


public class cpWarpHouse : MonoBehaviour
{
    public string sceneName;
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            SceneManager.LoadScene(sceneName);
        }
    
 
    }
}

Make sure your object have collider marked as trigger, than you can use:

I would be using a raycast since it is a game object in world space,

 if ( Input.GetMouseButtonDown (0)){ 
   RaycastHit hit; 
   Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); 
  if(hit.transform == gameObject) //replace gameobject with the GameObject you want
{
//load your scene here
}   
}
 }

this is assuming that your game object is in world space. In the case of UI environment, you can use an onMouseDown event on that game object and from there load your scene