i am trying to switch between levels and am getting error in the code

i am new to coding and getting error in this code. i dont know why

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

public class LevelCompleted : MonoBehaviour
{
    public int sceneBuildIndex;

    private void OnTriggerEnter2D(Collision2D other)
    {
        if (other.tag == "Player")
        {
            SceneManager.LoadScene(sceneBuildIndex, LoadSceneMode.Single);
        }
    }
}

,

your sceneBuildIndex needs to match scene index array that is defined in Build Settings. If you assign an index through Inspector that doesn’t match whatever is in settings, it will throw an error.

I think this (other.tag) is generating this cs1061 error. tag is not property of Collision2D. its other.collider.tag