issuimo/UnityResolve.hpp

How to create an instance and call a method?

ballsofsoul opened this issue · 4 comments

For example, we have a DirectoryInfo class in mscorlib, which methods take an its instance as first argument, which in-game being created using .ctor method and passing in it the needed path for later usage.

GetFiles, for example:

image

How to process that using UnityResolve?

UnityResolveClass* pClass;
DirectoryInfo* ptr = pClass->New<DirectoryInfo*>();
ptr->GetFiles(...)

UnityResolve::Class* pClass;
UnityResolve::Method* ptr = pClass->GetUnityResolve::Class("GetFiles");
ptr->Invoke<ReturnType*>(instance, UnityResolve::UnityType::String::New("file"), 0);

UnityResolveClass* pClass; DirectoryInfo* ptr = pClass->New<DirectoryInfo*>(); ptr->GetFiles(...)

Assuming i have implemented DirectoryInfo type?

UnityResolve::Method* ptr = pClass->GetUnityResolve::Class("GetFiles");

You meant UnityResolve::Method* ptr = pClass->Get<UnityResolve::Method>("GetFiles");?

yeah