Skip to content

Fix NotSupportedException during delegate marshaling in IL2CPP #23

@kisielewski

Description

@kisielewski

The application throws a NotSupportedException because IL2CPP does not support marshaling delegates that point to instance methods to native code. This occurs when passing lambda expressions or non-static methods as callbacks to native plugins. To resolve this, all affected delegates must be converted to static methods. The object instance should be passed to the native side as an IntPtr context (using GCHandle) and retrieved within the static callback to invoke the necessary instance logic.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions