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
// Unity Singleton Example | |
// Call with "ClassName.instance.Example();" | |
public static ClassName instance = null; //Static instance of singleton which allows it to be accessed by any other script. | |
//Awake is always called before any Start functions | |
void Awake() | |
{ | |
//Check if instance already exists | |
if (instance == null) | |
//if not, set instance to this |
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 UnityEngine; | |
// Unity MonoBehaviour Example | |
// MonoBehaviour is the base class from which every Unity script derives. | |
public class ExampleScript : MonoBehaviour | |
{ | |
// Awake is called when the script instance is being loaded. | |
void Awake(){} | |
// Start is called on the frame when a script is enabled just before any of the Update methods is called the first time. | |
void Start(){} |
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.Windows.Forms; | |
// Requires System.Windows.Forms added to a Plugins folder ( C:\Program Files\Unity\Editor\Data\MonoBleedingEdge\lib\mono\2.0) | |
// Requires .NET 2.0 (setting Player Setting -> Configuration -> Api Compatibility Level set to .NET 2.0) | |
// Warning! May throw windows errors in editor but works fine in builds | |
// Example Usage: | |
// WindowsNativeDialog.SimpleMessage("Hello World!"); | |
// WindowsNativeDialog.Message("Hello World!", "Title"); | |
// WindowsNativeDialog.WarningMessage("Hello World!", "Title"); |
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 UnityEngine; | |
using UnityEngine.SceneManagement; | |
using Oculus.Platform; | |
#if UNITY_4 || UNITY_5 | |
using UnityEngine.Events; | |
#endif | |
/* | |
Step 1: Download & Install Oculus Platform SDK | |
Step 2: Update your App ID in the Editor |
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 UnityEngine; | |
using Viveport; | |
public class QuitGoHome | |
{ | |
const int SUCCESS = 0; | |
private static bool isSubscriber = false; | |
static void Quit() | |
{ |
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.Generic; | |
using UnityEngine; | |
using UnityEngine.XR; | |
using Valve.VR; | |
/// <summary> | |
/// These are a few different ways to detect the current VR HMD and controller type. | |
/// - Unity XR api | |
/// - Unity Input api | |
/// - SteamVR plugin |
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
char serialNumber[1024]; | |
vr::VRSystem()->GetStringTrackedDeviceProperty(deviceID, vr::Prop_SerialNumber_String, serialNumber, sizeof(serialNumber)); | |
printf("Serial Number = %s \n", serialNumber); |
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
System.Diagnostics.Process process = new System.Diagnostics.Process(); | |
process.StartInfo.FileName = "C:\\Program Files (x86)\\Steam\\steamapps\\common\\SteamVR\\tools\\lighthouse\\bin\\win64\\lighthouse_console.exe"; | |
process.StartInfo.Arguments = "/serial 81F6B76702 poweroff"; | |
process.StartInfo.UseShellExecute = true; | |
process.StartInfo.CreateNoWindow = true; | |
process.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; | |
process.Start(); |
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 UnityEngine; | |
using UnityEngine.XR; | |
using Valve.VR; | |
// simple library and examples for XR haptics | |
// note: controllers must be tracking to use haptics | |
// other examples: https://vrtoolkit.readme.io/docs/vrtk_interacthaptics | |
public static class HapticPulse |
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
void EyeCalibration() | |
{ | |
Debug.Log("Start Calibration"); | |
int result = ViveSR.anipal.Eye.SRanipal_Eye_API.LaunchEyeCalibration(System.IntPtr.Zero); // Ptr not implemented so using Zero | |
Debug.Log("Finish Calibration: " + result); | |
} |
OlderNewer