Skip to content

Data Gathering Helpers

eisclimber edited this page Feb 11, 2024 · 1 revision

Data Gathering Binding

static class in ExPresSXR.Experimentation.DataGathering

Description

A bunch of helper functions for working with the DataGatherer and Reflections in Unity and C#.

Members

Public Members

  • readonly Dictionary<Type, string> primitiveTypeKeywords: A mapping of types to their name of supported types for exporting with the DataGatherer.
    The supported types are: bool, byte, char, decimal, double, float, int, long, sbyte, short, string, uint, ulong, ushort, Vector2, Vector3 and Quaternion

Public Methods

  • string ExtractComponentNumber(string compFullName, out int compNumber): Separates the component number from the provided component name.
    Returns the name without the number and returns the component number to the out parameter.
  • bool IsComponentMatch(Component component, string requiredFullName): Checks if the component matches the fully qualified name.
  • bool sIsGameObjectBinding(string classFullName): Checks if a name is bound to a GameObject (and not a Component).
  • bool AreParametersValid(MethodInfo methodInfo): Check if the parameters of a method can be used with the DataGatherer. Either no parameters, only optional or all optional but the first being a character (for the separator).
  • bool IsTypeExportable(Type type): Checks if the MemberInfo is valid for data gathering. The requirements are:
    • All: Must be an exportable type
    • Methods: Should not be of type void nor have any parameters and have no special name (e.g. auto-generated setters).
    • Property: Valid if can be read.
    • Fields: No additional requirements.
  • Type GetMemberValueType(MemberInfo info): Returns the (return-)type of the MemberInfo.
  • bool HasSeparatorType(MethodInfo methodInfo): Checks if a method has parameters, the first is mandatory and of type char while the rest are optional (Does not guarantee validity!).
  • bool HasOptionalSeparatorType(MethodInfo methodInfo): Checks if a method has only parameters and the first is of type char (Does not guarantee validity!).
  • object[] GetMethodParameterValues(MethodInfo methodInfo, char sep): Generates an array with the default values for all parameters but inserts the separator character if possible.
  • string GetPrettifiedMemberName(MemberInfo info): Generates a pretty name for a member, adding the members (return)type. If the member is a method, brackets are added including the notion for the optional separator char.

Constants

  • string GAME_OBJECT_FULL_NAME = "Game Object": Full name of the GameObject class. Used to differentiate Components and GameObjects.

ExPresS XR Wiki

Tutorial Pages

Code Documentation

Clone this wiki locally