タイトルシーンに戻るルートを作る
![715bdce4 b8a8 4c58 977b b76b42355509](https://codegenius.org/uploads/slide/image/507/715bdce4-b8a8-4c58-977b-b76b42355509.jpeg)
![616f24b9 3afb 498d bfcb 49afd5b04f95](https://codegenius.org/uploads/slide/image/508/616f24b9-3afb-498d-bfcb-49afd5b04f95.jpeg)
一定時間経過後タイトルシーンに戻る
using UnityEngine;
using System.Collections;
// ★追加
using UnityEngine.SceneManagement;
public class ReturnToTitle : MonoBehaviour {
// ★追加
public int timeCount;
void Start () {
// ★追加
// 任意に設定した時間の経過後、「GoTitle」メソッドを呼び出す(ポイント)
Invoke("GoTitle", timeCount);
}
// ★追加
void GoTitle(){
SceneManager.LoadScene("Title");
}
}
![99d8bcec f5fe 4353 a27d 8822088a5b12](https://codegenius.org/uploads/slide/image/509/99d8bcec-f5fe-4353-a27d-8822088a5b12.jpeg)
![3baa2ea8 354a 464c aa80 440110f5b317](https://codegenius.org/uploads/slide/image/510/3baa2ea8-354a-464c-aa80-440110f5b317.jpeg)
![8c68f6ed 0373 4003 bcb4 349ec4785a7a](https://codegenius.org/uploads/slide/image/511/8c68f6ed-0373-4003-bcb4-349ec4785a7a.jpeg)
【旧版】BallGame(全25回)
他のコースを見る![715bdce4 b8a8 4c58 977b b76b42355509](https://codegenius.org/uploads/slide/image/507/715bdce4-b8a8-4c58-977b-b76b42355509.jpeg)
![616f24b9 3afb 498d bfcb 49afd5b04f95](https://codegenius.org/uploads/slide/image/508/616f24b9-3afb-498d-bfcb-49afd5b04f95.jpeg)
一定時間経過後タイトルシーンに戻る
using UnityEngine;
using System.Collections;
// ★追加
using UnityEngine.SceneManagement;
public class ReturnToTitle : MonoBehaviour {
// ★追加
public int timeCount;
void Start () {
// ★追加
// 任意に設定した時間の経過後、「GoTitle」メソッドを呼び出す(ポイント)
Invoke("GoTitle", timeCount);
}
// ★追加
void GoTitle(){
SceneManager.LoadScene("Title");
}
}
![99d8bcec f5fe 4353 a27d 8822088a5b12](https://codegenius.org/uploads/slide/image/509/99d8bcec-f5fe-4353-a27d-8822088a5b12.jpeg)
![3baa2ea8 354a 464c aa80 440110f5b317](https://codegenius.org/uploads/slide/image/510/3baa2ea8-354a-464c-aa80-440110f5b317.jpeg)
![8c68f6ed 0373 4003 bcb4 349ec4785a7a](https://codegenius.org/uploads/slide/image/511/8c68f6ed-0373-4003-bcb4-349ec4785a7a.jpeg)
タイトルシーンに戻るルートを作る