UnityHotSwap icon indicating copy to clipboard operation
UnityHotSwap copied to clipboard

patching Coroutine methods

Open friuns2 opened this issue 7 years ago • 5 comments

for example this method patching not work IEnumerator cor() { Debug.Log("test4234"); yield return null; }

is it hard to add support for corontinue methods?

friuns2 avatar Jul 18 '17 12:07 friuns2

Oh hey, I completely missed this issue, for some reason Github chose not to e-mail me. No idea why.

Did you have much luck in any patching at all? I never managed to get this project into stable state, mainly because Unity lacks ability to add hooks to compilation process. I'm willing to go back and revisit it this year, though.

I'll keep coroutines in mind. If I remember correctly, when coroutine is compiled, a new class is created by the compiler that encapsulates the state machine and everything. So this feature might require having an ability to inject new types first.

zapu avatar Jul 24 '17 10:07 zapu

also i noticed its freezes for 5 seconds on big project after compilation, would be good if could pick which classes to patch instead everything

btw this project managed to patch corontinue methods but its memory patching https://github.com/pardeike/Harmony

friuns2 avatar Jul 25 '17 13:07 friuns2

Does it work with Unity? I was researching some memory patching ideas at first but couldn't figure anything like this out, I'm clueless about mono internals.

zapu avatar Jul 25 '17 13:07 zapu

yes and its seems easy to do it, just couple hungred lines of code whole project, but don't know how he did found out. maybe he used dnspy

friuns2 avatar Jul 26 '17 14:07 friuns2

FWIW there's a new version out that might be more stable. Definitely plays nicer with Unity because it does not need instrumentation to do patching.

Coroutines are still on the roadmap, though...

zapu avatar Jun 24 '18 11:06 zapu