Guides
Guides

VRTK_SDKManager

Overview

The SDK Manager script provides configuration of supported SDKs and manages a list of VRTK_SDKSetup scripts to use.

Inspector Parameters

  • Persist On Load: If this is true then the instance of the SDK Manager won't be destroyed on every scene load.
  • Auto Manage Script Defines: Determines whether the scripting define symbols required by the installed SDKs are automatically added to and removed from the player settings.
  • Script Alias Left Controller: A reference to the GameObject that contains any scripts that apply to the Left Hand Controller.
  • Script Alias Right Controller: A reference to the GameObject that contains any scripts that apply to the Right Hand Controller.
  • Auto Manage VR Settings: Determines whether the VR settings of the Player Settings are automatically adjusted to allow for all the used SDKs in the SDK Setups list below.
  • Auto Load Setup: Determines whether the SDK Setups list below is used whenever the SDK Manager is enabled. The first loadable Setup is then loaded.
  • Setups: The list of SDK Setups to choose from.

Class Variables

  • public readonly SDK_ScriptingDefineSymbolPredicateAttribute attribute - The predicate attribute.
  • public readonly MethodInfo methodInfo - The method info of the method the attribute is defined on.
  • public static ReadOnlyCollection<ScriptingDefineSymbolPredicateInfo> AvailableScriptingDefineSymbolPredicateInfos { get private set } - All found scripting define symbol predicate attributes with associated method info.
  • public static readonly Dictionary<Type, Type> SDKFallbackTypesByBaseType - Specifies the fallback SDK types for every base SDK type. Default: new Dictionary<Type, Type>
  • public static ReadOnlyCollection<VRTK_SDKInfo> AvailableSystemSDKInfos { get private set } - All available system SDK infos.
  • public static ReadOnlyCollection<VRTK_SDKInfo> AvailableBoundariesSDKInfos { get private set } - All available boundaries SDK infos.
  • public static ReadOnlyCollection<VRTK_SDKInfo> AvailableHeadsetSDKInfos { get private set } - All available headset SDK infos.
  • public static ReadOnlyCollection<VRTK_SDKInfo> AvailableControllerSDKInfos { get private set } - All available controller SDK infos.
  • public static ReadOnlyCollection<VRTK_SDKInfo> InstalledSystemSDKInfos { get private set } - All installed system SDK infos. This is a subset of . It contains only those available SDK infos for which an exists that uses the same symbol and whose associated method returns true.
  • public static ReadOnlyCollection<VRTK_SDKInfo> InstalledBoundariesSDKInfos { get private set } - All installed boundaries SDK infos. This is a subset of . It contains only those available SDK infos for which an exists that uses the same symbol and whose associated method returns true.
  • public static ReadOnlyCollection<VRTK_SDKInfo> InstalledHeadsetSDKInfos { get private set } - All installed headset SDK infos. This is a subset of . It contains only those available SDK infos for which an exists that uses the same symbol and whose associated method returns true.
  • public static ReadOnlyCollection<VRTK_SDKInfo> InstalledControllerSDKInfos { get private set } - All installed controller SDK infos. This is a subset of . It contains only those available SDK infos for which an exists that uses the same symbol and whose associated method returns true.
  • public static VRTK_SDKManager instance - The singleton instance to access the SDK Manager variables from.
  • public List<SDK_ScriptingDefineSymbolPredicateAttribute> activeScriptingDefineSymbolsWithoutSDKClasses - The active (i.e. to be added to the ) scripting define symbol predicate attributes that have no associated SDK classes. Default: new List<SDK_ScriptingDefineSymbolPredicateAttribute>()
  • public VRTK_SDKSetup loadedSetup { get private set } - The loaded SDK Setup. if no setup is currently loaded.
  • public ReadOnlyCollection<Behaviour> behavioursToToggleOnLoadedSetupChange { get private set } - All behaviours that need toggling whenever changes.

Class Events

  • LoadedSetupChanged - The event invoked whenever the loaded SDK Setup changes.

Unity Events

Adding the VRTK_SDKManager_UnityEvents component to VRTK_SDKManager object allows access to UnityEvents that will react identically to the Class Events.

  • All C# delegate events are mapped to a Unity Event with the On prefix. e.g. MyEvent -> OnMyEvent.

Event Payload

  • VRTK_SDKSetup previousSetup - The previous loaded Setup. if no previous Setup was loaded.
  • VRTK_SDKSetup currentSetup - The current loaded Setup. if no Setup is loaded anymore. See to check whether this is because of an error.
  • string errorMessage - Explains why loading a list of Setups wasn't successful if is and an error occurred. if no error occurred.

Class Methods

ScriptingDefineSymbolPredicateInfo/2

public ScriptingDefineSymbolPredicateInfo(SDK_ScriptingDefineSymbolPredicateAttribute attribute, MethodInfo methodInfo)

  • Parameters
  • SDK_ScriptingDefineSymbolPredicateAttribute attribute - The predicate attribute.
  • MethodInfo methodInfo - The method info of the method the attribute is defined on.
  • Returns
  • none

Event Payload. Constructs a new instance with the specified predicate attribute and associated method info.

ManageScriptingDefineSymbols/2

public bool ManageScriptingDefineSymbols(bool ignoreAutoManageScriptDefines, bool ignoreIsActiveAndEnabled)

  • Parameters
  • bool ignoreAutoManageScriptDefines - Whether to ignore while deciding to manage.
  • bool ignoreIsActiveAndEnabled - Whether to ignore while deciding to manage.
  • Returns
  • bool - Whether the ' scripting define symbols were changed.

Manages (i.e. adds and removes) the scripting define symbols of the for the currently set SDK infos. This method is only available in the editor, so usage of the method needs to be surrounded by #if UNITY_EDITOR and #endif when used in a type that is also compiled for a standalone build.

ManageVRSettings/1

public void ManageVRSettings(bool force)

  • Parameters
  • bool force - Whether to ignore while deciding to manage.
  • Returns
  • none

Manages (i.e. adds and removes) the VR SDKs of the for the currently set SDK infos. This method is only available in the editor, so usage of the method needs to be surrounded by #if UNITY_EDITOR and #endif when used in a type that is also compiled for a standalone build.

AddBehaviourToToggleOnLoadedSetupChange/1

public void AddBehaviourToToggleOnLoadedSetupChange(Behaviour behaviour)

  • Parameters
  • Behaviour behaviour - The behaviour to add.
  • Returns
  • none

Adds a behaviour to the list of behaviours to toggle when changes.

RemoveBehaviourToToggleOnLoadedSetupChange/1

public void RemoveBehaviourToToggleOnLoadedSetupChange(Behaviour behaviour)

  • Parameters
  • Behaviour behaviour - The behaviour to remove.
  • Returns
  • none

Removes a behaviour of the list of behaviours to toggle when changes.

TryLoadSDKSetupFromList/1

public void TryLoadSDKSetupFromList(bool tryUseLastLoadedSetup = true)

  • Parameters
  • none
  • Returns
  • none

Tries to load a valid from .

TryLoadSDKSetup/3

public void TryLoadSDKSetup(int startIndex, bool tryToReinitialize, params VRTK_SDKSetup[] sdkSetups)

  • Parameters
  • int startIndex - The index of the to start the loading with.
  • bool tryToReinitialize - Whether or not to retry initializing and using the currently set but unusable VR Device.
  • params VRTK_SDKSetup[] sdkSetups - The list to try to load a from.
  • Returns
  • none

Tries to load a valid from a list. The first loadable in the list will be loaded. Will fall back to disable VR if none of the provided Setups is useable.

SetLoadedSDKSetupToPopulateObjectReferences/1

public void SetLoadedSDKSetupToPopulateObjectReferences(VRTK_SDKSetup setup)

  • Parameters
  • VRTK_SDKSetup setup - The SDK Setup to set as the loaded SDK.
  • Returns
  • none

Sets a given as the loaded SDK Setup to be able to use it when populating object references in the SDK Setup. This method should only be called when not playing as it's only for populating the object references. This method is only available in the editor, so usage of the method needs to be surrounded by #if UNITY_EDITOR and #endif when used in a type that is also compiled for a standalone build.

UnloadSDKSetup/1

public void UnloadSDKSetup(bool disableVR = false)

  • Parameters
  • bool disableVR - Whether to disable VR altogether after unloading the SDK Setup.
  • Returns
  • none

Unloads the currently loaded , if there is one.