- Home /
Question by
NickEberhart · Jul 08, 2016 at 11:33 AM ·
collision detectionplatformerscene-switching
Scene switching and loading problems
I am working on a platformer and I have a sprite that when it collides with the player it loads a new scene (whatever scene you tell it to load). Here is the code (C#) also I have a screenshot of the errors, Any help is greatly appreciated!
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;
public class SceneSwitchCollision : MonoBehaviour
{
// Use this for initialization
void OnCollisionEnter2D (Collision2D Colider)
{
if (Colider.gameObject.tag == "Player") {
SceneManager.LoadScene(string. scenePath);
}
}
}
errrrrrrrrrrrrrrors.png
(15.1 kB)
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612084423im_/https://answers.unity.com/themes/thub/images/avi.jpg)