Hello, i got a plugin for unity that interacts with bluetooth.
My plugin is basically just a wrapper for the dll that talks with the bluetooth, and it exposes very basic methods.
the dll i’m wrapping, has references to Newtonsoft.Json.dll
and after i build my plugin solution, this is how my unity project looks like:
editor plugin:
WSA plugin:
PluginLayer is the only code i want to use from unity. and it followed the steps on how to set up a plugin (WSA PluginLayer has a placeholder, and is set to WSA in plugin settings)
when i try to build, i get about 600 errors, which are all the same almost:
Reference Rewriter: Error: method `System.Reflection.ConstructorInfo System.Type::GetConstructor(System.Type[])` doesn`t exist in target framework. It is referenced from Newtonsoft.Json.dll at Newtonsoft.Json.Utilities.ReflectionObject Newtonsoft.Json.Converters.KeyValuePairConverter::InitializeReflectionObject(System.Type).
UnityEngine.Debug:LogError(Object)
PostProcessMetroPlayer:RunReferenceRewriter(WSASDK, String, String, String, String) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/PostProcessMetroPlayer.cs:334)
PostProcessMetroPlayer:PostProcessSDKSpecific(WSASDK, BuildTarget, BuildOptions, String, String, ProjectImages, LibraryCollection) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/PostProcessMetroPlayer.cs:883)
PostProcessMetroPlayer:PostProcess(BuildTarget, BuildOptions, String, String, String, String) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/PostProcessMetroPlayer.cs:59
if i set all the JSON files to “don`t process” these errors don’t appear it i can compile the result successfully.
but i get an exception when i try to use the plugin. (doing new PluginLayer in a unity script).
So… my questions are:
-
Is my plugin structure correct? am i supposed to get all these JSON files that the dll i’m wrapping with a plugin uses?
-
what do i do about these error? why do they happen?
and why does “don’t process” make them go away? -
is there any way to debug what happens when i try to create the plugin?
thanks to anyone who can help!
SOLVED:
I didn’t get any answers but a co-worker helped me, so i’ll share the information
-
yes, the pluging structure was correct
and also, i changed all the plugins to “don’t process”. -
the errors didn’t happen once “don’t process” was enabled.
furthermore, the issue in my plugin code was happening because it was running on a different THREAD.
the solution, is to use the plugin code in the unity UI Thread. -
to debug the code, you need to remove the reference to the dll in the built VS solution.
and then add an existing project (the project the dll was from)
and now reference the project instead.