-
-
Notifications
You must be signed in to change notification settings - Fork 2
Runtime Utils
eisclimber edited this page Feb 11, 2024
·
2 revisions
static class in ExPresSXR.Misc
A class for utility functions that are executable during runtime making the usable in the final build of the project.
-
Transform RecursiveFindChild(Transform parent, string childName)
: Finds and returns the (first) Transform of a child with the specified name. -
bool TryFindExPresSXRRigReference(out ExPresSXRRig rig)
: Finds the first ExPresSXRRig in the scene (if exists). Returns true if the rig was found and set to the out parameter and false otherwise.
Be aware that the rig must be tagged as "Player"!
This operation is expensive, call it sparingly and rather use direct References to the rig whenever possible!! -
int PosMod(int a, int b)
: Helper class to calculate the positive modulo for integers. It differs from the remainder function (%) as it will return only positive values including zero. -
void ChangeSceneWithFade(ExPresSXRRig rig, int sceneIdx, bool keepRig, Action sceneLoadedCallback)
: Changes a scene whilst the current rig is faded out. Supports 'DontDestroyOnLoad' if enabled on the rig. If no rig is provided or it does does not have a fade Rect the Scene will change instant. -
void SwitchSceneAsync(int sceneIdx, Action callback)
: Switches the scene to the given index (if possible) and invokes a callback after completion. -
void PopulateDropDownWithEnum(Dropdown dropdown, Type enumType)
: Populates a Dropdown with the names of a given Enum. -
void PopulateTMPDropDownWithEnum(Dropdown dropdown, Type enumType)
: Populates a TMP_Dropdown with the names of a given Enum. -
void PopulateTMPDropDownWithFlags(TMP_Dropdown dropdown, Type enumType)
: Populates a TMP_Dropdown with the names of a given Enum. Be careful as this will produce an entry for every combination, meaning 2^{Enum.Length} entries. -
void PopulateTMPDropDownWithCustomValues(TMP_Dropdown dropdown, string[] stringOptions)
: Populates a with the names proved by stringOptions. -
T DropdownToUnityFlagValue<T>(int value) where T : Enum
: Enforces Unity's Flags rules on an int from a Dropdown where 'Everything' = -1 and not only 1's. -
int UnityToDropdownFlagValue<T>(T value) where T : Enum
: Changes a Unity's Flags value to an int from a Dropdown where 'Everything' is the last entry in the list.
Autor: Luca 'eisclimber' Dreiling; License: MIT
- Getting Started
- Development and Contribution
- Misc
- Experimentation
- Data Gatherering
- Eye Tracking
- ExPresS XR Rig
- Interaction
- Base Button
- Button Quiz
- Collision Hand Rumbler
- Collision Sound Emitter
- Exit Game Interactable (Script Deprecated)
- Interactables
- Haptic Impulse Trigger
- Socket Interactors
- Inverse Kinematics
- Localization
- Minigames
- Coin Scale
- Coin Throw
- Sword Cleaning
- Misc
- Movement
- Presentation
- UI