public static void InvalidateCaches()
        {
#if UNITY_EDITOR
            Object.DestroyImmediate(systemSDK);
            Object.DestroyImmediate(headsetSDK);
            Object.DestroyImmediate(controllerSDK);
            Object.DestroyImmediate(boundariesSDK);
            Object.DestroyImmediate(trackerSDK);
            Object.DestroyImmediate(handSDK);
#else
            Object.Destroy(systemSDK);
            Object.Destroy(headsetSDK);
            Object.Destroy(controllerSDK);
            Object.Destroy(boundariesSDK);
            Object.Destroy(trackerSDK);
            Object.Destroy(handSDK);
#endif

            systemSDK     = null;
            headsetSDK    = null;
            controllerSDK = null;
            boundariesSDK = null;
            trackerSDK    = null;
            handSDK       = null;
        }
        /// <summary>
        /// The GetSystemSDK method returns the selected system SDK
        /// </summary>
        /// <returns>The currently selected System SDK</returns>
        public SDK_BaseSystem GetSystemSDK()
        {
            SDK_BaseSystem returnSDK = null;

            switch (systemSDK)
            {
            case SupportedSDKs.SteamVR:
                returnSDK = ScriptableObject.CreateInstance <SDK_SteamVRSystem>();
                break;

            case SupportedSDKs.OculusVR:
                returnSDK = ScriptableObject.CreateInstance <SDK_OculusVRSystem>();
                break;

            case SupportedSDKs.Simulator:
                returnSDK = ScriptableObject.CreateInstance <SDK_SimSystem>();
                break;

            default:
                Debug.LogError("No valid System SDK has been selected. If you're seeing this error in Unity Edit mode, then try selecting the GameObject with the `VRTK_SDKManager` script and selecting a valid System SDK from the dropdown list.");
                returnSDK = ScriptableObject.CreateInstance <SDK_FallbackSystem>();
                break;
            }
            return(returnSDK);
        }
Example #3
0
 private static SDK_BaseSystem GetSystemSDK()
 {
     if (systemSDK == null)
     {
         systemSDK = (VRTK_SDKManager.instance ? VRTK_SDKManager.instance.GetSystemSDK() : ScriptableObject.CreateInstance <SDK_FallbackSystem>());
     }
     return(systemSDK);
 }
Example #4
0
        /// <summary>
        /// The GetSystemSDK method returns the selected system SDK.
        /// </summary>
        /// <returns>The currently selected system SDK.</returns>
        public SDK_BaseSystem GetSystemSDK()
        {
            if (cachedSystemSDK == null)
            {
                HandleSDKGetter <SDK_BaseSystem>("System", systemSDKInfo, InstalledSystemSDKInfos);
                cachedSystemSDK = (SDK_BaseSystem)ScriptableObject.CreateInstance(systemSDKInfo.type);
            }

            return(cachedSystemSDK);
        }
 public static SDK_BaseSystem GetSystemSDK()
 {
     if (VRTK_SDKManager.instance != null && VRTK_SDKManager.instance.loadedSetup != null)
     {
         return(VRTK_SDKManager.instance.loadedSetup.systemSDK);
     }
     if (systemSDK == null)
     {
         systemSDK = ScriptableObject.CreateInstance <SDK_FallbackSystem>();
     }
     return(systemSDK);
 }
Example #6
0
        /// <summary>
        /// The GetSystemSDK method returns the selected system SDK
        /// </summary>
        /// <returns>The currently selected System SDK</returns>
        public SDK_BaseSystem GetSystemSDK()
        {
            SDK_BaseSystem returnSDK = null;

            switch (systemSDK)
            {
            case SupportedSDKs.SteamVR:
                returnSDK = ScriptableObject.CreateInstance <SDK_SteamVRSystem>();
                break;

            case SupportedSDKs.OculusVR:
                returnSDK = ScriptableObject.CreateInstance <SDK_OculusVRSystem>();
                break;

            default:
                returnSDK = ScriptableObject.CreateInstance <SDK_FallbackSystem>();
                break;
            }
            return(returnSDK);
        }
Example #7
0
        private static SDK_InterfaceSystem GetSystemSDK()
        {
            if (systemSDK == null)
            {
                systemSDK = ScriptableObject.CreateInstance <SDK_FallbackSystem>();
                if (VRTK_SDKManager.instance)
                {
                    switch (VRTK_SDKManager.instance.systemSDK)
                    {
                    case VRTK_SDKManager.SupportedSDKs.SteamVR:
                        systemSDK = ScriptableObject.CreateInstance <SDK_SteamVRSystem>();
                        break;

                    default:
                        Debug.LogError("No System SDK configured, falling back to generic System SDK.");
                        break;
                    }
                }
            }
            return(systemSDK);
        }