Skip to content

Is it possible to hook field changes? #380

Closed Answered by kiber-io
kiber-io asked this question in Q&A
Discussion options

You must be logged in to vote

I asked myself, I immediately found the answer myself :D

const csharp = Il2Cpp.domain.assembly('Assembly-CSharp').image

csharp.class('Account').method('get_Instance').implementation = function () {
    let acc = this.method('get_Instance').invoke()
    // acc is Account instance
    return acc
}

it turns out that for such a construction with Instance, its own get_<field name> method is created. Apparently, these are features of C#, and I practically didn't write on it.
Actually, in my case, it also gives the opportunity to replace the values of the fields at the same time

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by kiber-io
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@kiber-io
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants