Created
November 30, 2019 09:22
-
-
Save IshidaGames/42f246eace53132515f70a55b5dc6582 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
//Scene遷移に必要 | |
using UnityEngine.SceneManagement; | |
public class SceneMove : MonoBehaviour | |
{ | |
//Inspector上で遷移先の名前を入れる | |
public string sceneName; | |
//Playerタグがついたオブジェクトに衝突するとSceneが遷移する | |
private void OnCollisionEnter(UnityEngine.Collision collision) | |
{ | |
if (collision.gameObject.tag == "Player") | |
{ | |
SceneManager.LoadScene(sceneName); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment