Support injecting fields in il2cpp domain #24
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Class Injection
Injects a class' fields and their corresponding il2cpp type with proper attributes set (attributes are required for asset bundle field serialization)
Adds
Il2CppReferenceField
andIl2CppValueField
each responsible for wrapping an il2cpp field at runtime.Native Classes
Adds extra
Size
methods to UnityVersionHandler for each struct handler.Wraps
fields
andfield_count
in native classes.Wraps
attrs
in native types.QOL
Il2CppObjectBase now has a propery
ObjectClass
which returns the object's native class pointer.Fixes an exception being thrown in ClassInjector when a class has no namespace.
ClassInjector now uses a struct
InjectedClassData
to store the managed gc handle instead of an IntPtr.Il2CppClassPointerStore now has a non-generic version that handles getting the class pointers through reflection.
Notes
Il2CppSystem.String
reference types do not get deserialized correctly from asset bundles and do not persist after being set.Il2Cpp*Field
classes have a stub implicit operator to support future default value support but at the moment do nothing.Field Injection Example
Unity Editor Script
Injection Script