UnityResolve allows you to traverse the assembly hierarchy to find classes, access fields (get/set), and invoke methods.
Workflow:
- Get the assembly using
UnityResolve::Get("assembly.dll"). - Get the class using
assembly->Get("ClassName"). - Access fields via
pClass->Get<UnityResolve::Field>("FieldName") or pClass->Get<T>("FieldName") for offsets. - Access methods via
pClass->Get<UnityResolve::Method>("MethodName"). - Use
Invoke<T>(args...) or Cast<T>(...) to execute methods.
const auto assembly = UnityResolve::Get("assembly.dll");
const auto pClass = assembly->Get("className");
// Field Access
const auto field = pClass->Get<UnityResolve::Field>("FieldName");
int val = pClass->GetValue<int>(objInstance, "fieldName");
pClass->SetValue<int>(objInstance, "fieldName", 123);
// Method Invocation
const auto method = pClass->Get<UnityResolve::Method>("MethodName");
method->Invoke<int>(114, 514, "arg_string");
// Method Casting (for direct calls)
const UnityResolve::MethodPointer<void, int, bool> ptr = method->Cast<void, int, bool>();
ptr(114514, true);