How can I write a more efficient script for changing scenes from a map scene?

Hi I am wondering how I might go about writing a more efficient script that handles all the scene changes that can occur on a map. I have several pin points that when clicked take you to a different scene and at the moment I basically have the same script on each different game object (pin) but im wondering if there is a better way to do this? This is an example of one of the scripts I have on the pins currently:

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

public class SceneChange : MonoBehaviour
{

private void OnMouseDown() 
{
    SceneManager.LoadScene("PinOne");
}

}

Hopefully someone can help, thanks in advance :slight_smile:

Hi just wanted to update for followers of this question I managed to solve this with the following code:

public string sceneName;

private void OnMouseDown() 
{
    if (sceneName != null)
    {
     SceneManager.LoadScene(sceneName);
    }
}

This way you can add the scene you want to change to into the ‘scene name’ box in the inspector once you attach the script to each object (in this case the pins on the map)