error CS0542

C#
// make sure that your function doesn't have the same name as the script

//example:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class Respawn : MonoBehaviour{
  
  public void Respawn()
    {
        SceneManager.LoadScene(1);
    }
}

//answer:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class Respawn : MonoBehaviour{
  
  public void Respawning()
    {
        SceneManager.LoadScene(1);
    }
}
Source

Also in C#: