Not sure what this script is attached to but if it's on the player, and it has a collider, you just need this:
void OnTriggerEnter(Collider col)
{
if (col.name == "Sphere")
SceneManager.LoadScene("YouWon");
// Do something else here if it's not an object named "Sphere"
}
Also, you can't declare a variable that has an accessor (public, private, etc...) inside a function.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…