Skip to content
This repository has been archived by the owner on May 9, 2023. It is now read-only.

ReflectionUtility

Sinai edited this page Jan 30, 2022 · 3 revisions

The ReflectionUtility and ReflectionExtensions classes contain helpers for using general reflection API, for things which HarmonyX does not provide. Most of the helpers are for making IL2CPP reflection easier.

In particular, the main helpers are:

  • ReflectionUtility.GetTypeByName("Some.Full.Name"); - to find a Type by its type.FullName.
    • For generic types, you need to use the `1 notation.
  • object.GetActualType() - returns the underlying type of the object, including IL2CPP object types. This also deobfuscates the type name for IL2CPP games.
  • object.TryCast(type) - helper for IL2CPP-safe casting

See the source for all available helpers.

Clone this wiki locally