Guides
Guides

ScriptingDefineSymbolPredicateInfo

Overview

A helper class that simply holds references to both the SDK_ScriptingDefineSymbolPredicateAttribute and the method info of the method the attribute is defined on.

Inspector Parameters

  • 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.
  • Exclude Target Groups: The list of Build Target Groups to exclude.

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 AvailableSystemSDKInfos. It contains only those available SDK infos for which an SDK_ScriptingDefineSymbolPredicateAttribute 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 AvailableBoundariesSDKInfos. It contains only those available SDK infos for which an SDK_ScriptingDefineSymbolPredicateAttribute 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 AvailableHeadsetSDKInfos. It contains only those available SDK infos for which an SDK_ScriptingDefineSymbolPredicateAttribute 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 AvailableControllerSDKInfos. It contains only those available SDK infos for which an SDK_ScriptingDefineSymbolPredicateAttribute 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 static HashSet<Behaviour> delayedToggleBehaviours - A collection of behaviours to toggle on loaded setup change. Default: new HashSet<Behaviour>()
  • public List<SDK_ScriptingDefineSymbolPredicateAttribute> activeScriptingDefineSymbolsWithoutSDKClasses - The active (i.e. to be added to the PlayerSettings) scripting define symbol predicate attributes that have no associated SDK classes. Default: new List<SDK_ScriptingDefineSymbolPredicateAttribute>()
  • public VRTK_SDKSetup loadedSetup - The loaded SDK Setup. null if no setup is currently loaded.
  • public ReadOnlyCollection<Behaviour> behavioursToToggleOnLoadedSetupChange { get private set } - All behaviours that need toggling whenever loadedSetup 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. null if no previous Setup was loaded.
  • VRTK_SDKSetup currentSetup - The current loaded Setup. null if no Setup is loaded anymore. See errorMessage to check whether this is null because of an error.
  • string errorMessage - Explains why loading a list of Setups wasn't successful if currentSetup is null and an error occurred. null 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.

ValidInstance/0

public static bool ValidInstance()

  • Parameters
    • none
  • Returns
    • bool - Returns true if the SDK Manager instance is valid or returns false if it is null.

The ValidInstance method returns whether the SDK Manager isntance is valid (i.e. it's not null).

AttemptAddBehaviourToToggleOnLoadedSetupChange/1

public static bool AttemptAddBehaviourToToggleOnLoadedSetupChange(Behaviour givenBehaviour)

  • Parameters
    • Behaviour givenBehaviour - The behaviour to add.
  • Returns
    • bool - Returns true if the SDK Manager instance was valid.

The AttemptAddBehaviourToToggleOnLoadedSetupChange method will attempt to add the given behaviour to the loaded setup change toggle if the SDK Manager instance exists. If it doesn't exist then it adds it to the delayedToggleBehaviours HashSet to be manually added later with the ProcessDelayedToggleBehaviours method.

AttemptRemoveBehaviourToToggleOnLoadedSetupChange/1

public static bool AttemptRemoveBehaviourToToggleOnLoadedSetupChange(Behaviour givenBehaviour)

  • Parameters
    • Behaviour givenBehaviour - The behaviour to remove.
  • Returns
    • bool - Returns true if the SDK Manager instance was valid.

The AttemptRemoveBehaviourToToggleOnLoadedSetupChange method will attempt to remove the given behaviour from the loaded setup change toggle if the SDK Manager instance exists.

ProcessDelayedToggleBehaviours/0

public static void ProcessDelayedToggleBehaviours()

  • Parameters
    • none
  • Returns
    • none

The ProcessDelayedToggleBehaviours method will attempt to addd the behaviours in the delayedToggleBehaviours HashSet to the loaded setup change toggle.

SubscribeLoadedSetupChanged/1

public static bool SubscribeLoadedSetupChanged(LoadedSetupChangeEventHandler callback)

  • Parameters
    • LoadedSetupChangeEventHandler callback - The callback to register.
  • Returns
    • bool - Returns true if the SDK Manager instance was valid.

The SubscribeLoadedSetupChanged method attempts to register the given callback with the LoadedSetupChanged event.

UnsubscribeLoadedSetupChanged/1

public static bool UnsubscribeLoadedSetupChanged(LoadedSetupChangeEventHandler callback)

  • Parameters
    • LoadedSetupChangeEventHandler callback - The callback to unregister.
  • Returns
    • bool - Returns true if the SDK Manager instance was valid.

The UnsubscribeLoadedSetupChanged method attempts to unregister the given callback from the LoadedSetupChanged event.

GetLoadedSDKSetup/0

public static VRTK_SDKSetup GetLoadedSDKSetup()

  • Parameters
    • none
  • Returns
    • VRTK_SDKSetup - Returns true if the SDK Manager instance was valid.

The GetLoadedSDKSetup method returns the current loaded SDK Setup for the SDK Manager instance.

GetAllSDKSetups/0

public static VRTK_SDKSetup[] GetAllSDKSetups()

  • Parameters
    • none
  • Returns
    • VRTK_SDKSetup[] - An SDKSetup array of all valid SDK Setups for the current SDK Manager instance. If no SDK Manager instance is found then an empty array is returned.

The GetAllSDKSetups method returns all valid SDK Setups attached to the SDK Manager instance.

AttemptTryLoadSDKSetup/3

public static bool AttemptTryLoadSDKSetup(int startIndex, bool tryToReinitialize, params VRTK_SDKSetup[] sdkSetups)

  • Parameters
    • int startIndex - The index of the VRTK_SDKSetup 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 VRTK_SDKSetup from.
  • Returns
    • bool - Returns true if the SDK Manager instance was valid.

The AttemptTryLoadSDKSetup method attempts to load a valid VRTK_SDKSetup from a list if the SDK Manager instance is valid.

AttemptTryLoadSDKSetupFromList/1

public static bool AttemptTryLoadSDKSetupFromList(bool tryUseLastLoadedSetup = true)

  • Parameters
    • bool tryUseLastLoadedSetup - Attempt to use the last loaded setup if it's available.
  • Returns
    • bool - Returns true if the SDK Manager instance was valid.

The AttemptUnloadSDKSetup method tries to load a valid VRTK_SDKSetup from setups if the SDK Manager instance is valid.

AttemptUnloadSDKSetup/1

public static bool AttemptUnloadSDKSetup(bool disableVR = false)

  • Parameters
    • bool disableVR - Whether to disable VR altogether after unloading the SDK Setup.
  • Returns
    • bool - Returns true if the SDK Manager instance was valid.

The AttemptUnloadSDKSetup method attempts to unload the currently loaded VRTK_SDKSetup, if there is one and if the SDK Manager instance is valid.

ManageScriptingDefineSymbols/2

public bool ManageScriptingDefineSymbols(bool ignoreAutoManageScriptDefines, bool ignoreIsActiveAndEnabled)

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

The ManageScriptingDefineSymbols method manages (i.e. adds and removes) the scripting define symbols of the PlayerSettings 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 autoManageVRSettings while deciding to manage.
  • Returns
    • none

The ManageVRSettings method manages (i.e. adds and removes) the VR SDKs of the PlayerSettings 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

The AddBehaviourToToggleOnLoadedSetupChange method adds a behaviour to the list of behaviours to toggle when loadedSetup changes.

RemoveBehaviourToToggleOnLoadedSetupChange/1

public void RemoveBehaviourToToggleOnLoadedSetupChange(Behaviour behaviour)

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

The RemoveBehaviourToToggleOnLoadedSetupChange method removes a behaviour of the list of behaviours to toggle when loadedSetup changes.

TryLoadSDKSetupFromList/1

public void TryLoadSDKSetupFromList(bool tryUseLastLoadedSetup = true)

  • Parameters
    • bool tryUseLastLoadedSetup - Attempt to use the last loaded setup if it's available.
  • Returns
    • none

The TryLoadSDKSetupFromList method tries to load a valid VRTK_SDKSetup from setups.

TryLoadSDKSetup/3

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

  • Parameters
    • int startIndex - The index of the VRTK_SDKSetup 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 VRTK_SDKSetup from.
  • Returns
    • none

The TryLoadSDKSetup method tries to load a valid VRTK_SDKSetup from a list. The first loadable VRTK_SDKSetup 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

The SetLoadedSDKSetupToPopulateObjectReferences method sets a given VRTK_SDKSetup 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

The UnloadSDKSetup method unloads the currently loaded VRTK_SDKSetup, if there is one.