ialex32x / unity-jsb

It brings Javascript runtime capability to Unity3D by integrating QuickJS.
MIT License
335 stars 41 forks source link

Object conversion improvements #80

Closed KurtGokhan closed 2 years ago

KurtGokhan commented 2 years ago

1 - The line with type.BaseType == typeof(MulticastDelegate) was unneeded as I understand. _CSCastMap will already have a caster for this type. Removing it also allows register_type_caster<Delegate> to work. 2 - Allows register_type_caster<object>. This type caster will be ignored at first and used at the end as a fallback in the js_push_var. 3 - Reverted WeakRef changes to DynamicDelegateMethod. This change was causing C# delegates to be GCed early. I think it is ok if QuickJS holds on to C# delegates until it is disposed. I am not sure of the side effects of this change. But with this PR, I don't have GC leak in my code anymore.