The checkpoint script I used was very handy, so I want to share it

C# for Unity Engine:

using UnityEngine;

public class Checkpoint : MonoBehaviour
{
    public static Vector3 startPos;

    public GameObject enabledflag;
    public GameObject disabledflag;

    // just to make sure the value is set to zero when you enter play mode in the editor
    [RuntimeInitializeOnLoadMethod(
        RuntimeInitializeLoadType.SubsystemRegistration)]
    static void DomainReload()
    {
        startPos = Vector3.zero;
    }

    private void Update()
    {
        bool isActiveCheckpoint = startPos == transform.position;

        enabledflag.SetActive(isActiveCheckpoint);
        disabledflag.SetActive(!isActiveCheckpoint);
    }

    private void OnTriggerEnter2D(Collider2D collision)
    {
        startPos = transform.position;
    }
}

and inside the player script ..

void Awake()
{
    if (Checkpoint.startPos != Vector3.zero)
    {
        transform.position = Checkpoint.startPos;
    }
}

If you have any questions, feel free to ask. ^^

And for 2D make sure the checkpoint transform is at the same Z-Position as your player.

If you like puzzle-platformers and want to see it in action, here is the link to our game: Music Demon