Skip to content

Instantly share code, notes, and snippets.

@GOROman
Last active October 7, 2017 13:02
Show Gist options
  • Select an option

  • Save GOROman/7b6dc756eb6b3be566e1d327c086a773 to your computer and use it in GitHub Desktop.

Select an option

Save GOROman/7b6dc756eb6b3be566e1d327c086a773 to your computer and use it in GitHub Desktop.
VR展示とかで便利なシーンをキーボードのキーでリロードする
using UnityEngine;
using UnityEngine.SceneManagement;
public class SceneReloader : MonoBehaviour {
public KeyCode reloadKey = KeyCode.Tab; // このキーを押すとシーンリロードする
public int reloadScene = 0; // リロード時のシーン番号
void Update () {
if ( Input.GetKeyDown( reloadKey ) )
{
print( "Reload Scene" );
SceneManager.LoadScene( reloadScene );
}
}
}
@GOROman

GOROman commented Oct 7, 2017

Copy link
Copy Markdown
Author

適当なオブジェクトにこのスクリプトを追加して使えます。
デフォルトではTABキーでリロード。

@GOROman

GOROman commented Oct 7, 2017

Copy link
Copy Markdown
Author

Oculus Remoteとかでリロードやリセンター出来るようにすると更に便利。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment