モジュールUnityEngine.SceneManagementを使ってシーンをリセットしてみます。
ごみオブジェクトが溜まりすぎたときは一気に消去できて便利です。
DayDreamコントローラーのAppボタンが押されたとき、シーンがロードされます。
GvrControllerInput.AppButtonDownとSceneManager.LoadScene(0)を使っています。
スクリプト(Reset.cs)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; // これ 重要 public class Reset : MonoBehaviour { private void Update() { if (GvrControllerInput.AppButtonDown) { SceneManager.LoadScene(0); } } } |
以上でございます。(´・ω・`)
The following two tabs change content below.
Keita N
最新記事 by Keita N (全て見る)
- DDPG by gymnasium 15日目 - 2023年6月2日
- DDPG by gymnasium 14日目 - 2023年6月1日
- DDPG by gymnasium 13日目 - 2023年5月28日