ChangeScene geändert. Wird ab jetzt einem Trigger zugewiesen.

This commit is contained in:
Maximilian Wagner
2023-06-11 23:33:34 +02:00
parent 1f55a68b17
commit 0bd5ec0775
10 changed files with 53 additions and 25 deletions

View File

@@ -17,6 +17,8 @@ MonoBehaviour:
description:
preview: {fileID: 0}
dependencies:
- dependency: {fileID: 2800000, guid: 1455a3c98fe793a4782adb5e07c09200, type: 3}
instantiationMode: 0
- dependency: {fileID: 2800000, guid: 3a7e66d5a44a93a4c92b1ec5adbbbab9, type: 3}
instantiationMode: 0
- dependency: {fileID: 6200000, guid: 9a162dcdc92b4194ba53630f8785bed1, type: 2}

View File

@@ -17,6 +17,8 @@ MonoBehaviour:
description:
preview: {fileID: 0}
dependencies:
- dependency: {fileID: 2800000, guid: 1455a3c98fe793a4782adb5e07c09200, type: 3}
instantiationMode: 0
- dependency: {fileID: 2800000, guid: 3a7e66d5a44a93a4c92b1ec5adbbbab9, type: 3}
instantiationMode: 0
- dependency: {fileID: 6200000, guid: 9a162dcdc92b4194ba53630f8785bed1, type: 2}

View File

@@ -6,6 +6,8 @@ using UnityEngine.SceneManagement;
public class ChangeScene : MonoBehaviour
{
public string SceneName;
public Scene changeTo;
// Start is called before the first frame update
void Start()
@@ -19,11 +21,11 @@ public class ChangeScene : MonoBehaviour
}
private void OnCollisionEnter2D(Collision2D other)
private void OnTriggerEnter2D(Collider2D other)
{
if (other.gameObject.CompareTag("SceneChanger"))
if (other.gameObject.CompareTag("Player"))
{
SceneManager.LoadScene(other.gameObject.name);
SceneManager.LoadScene(SceneName);
}
}
}