- Home /
Windows Metro Class Library
I want to call UnityPlayer.AppCallbacks.Instance.InvokeOnAppThread function from MyPlugin. But i can not add UnityPlayer.dll to reference of MyPlugin. After i am trying to build , visual studio return this error:
There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture, "x86", of the implementation file "C:\\\\Program Files (x86)\\Unity\\Editor\\Data\\PlaybackEngines\\metrosupport\\Players\\Windows80\\X86\\release\\UnityPlayer.dll" for "C:\\Program Files (x86)\\Unity\\Editor\\Data\\PlaybackEngines\\metrosupport\\Players\\Windows80\\X86\\release\\UnityPlayer.winmd". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and implementation file, or choose a winmd file with an implementation file that has a processor architecture which matches the targeted processor architecture of your project.
How can i add UnityPlayer.dll to my class library ? or How can i call unity thread from class library ?
Answer by miratrix · Mar 13, 2015 at 07:02 PM
Works only for unity 4.6.* If you build anything for wp8,and open .csproj file with any xml editor, you will see that unity adds different versions of UnityPlayer.dll(arm and x86) based on what you select
<When Condition=" '$(Configuration)' == 'Debug' Or '$(Configuration)' == 'Release' ">
<ItemGroup>
<Reference Include="BridgeInterface">
<HintPath>..\Players\$(Platform)\Release\BridgeInterface.winmd</HintPath>
</Reference>
<Reference Include="UnityPlayer">
<HintPath>..\Players\$(Platform)\Release\UnityPlayer.winmd</HintPath>
</Reference>
<Reference Include="WinRTBridge">
<HintPath>..\Players\$(Platform)\Release\WinRTBridge.dll</HintPath>
</Reference>
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<Reference Include="BridgeInterface">
<HintPath>..\Players\$(Platform)\$(Configuration)\BridgeInterface.winmd</HintPath>
</Reference>
<Reference Include="UnityPlayer">
<HintPath>..\Players\$(Platform)\$(Configuration)\UnityPlayer.winmd</HintPath>
</Reference>
<Reference Include="WinRTBridge">
<HintPath>..\Players\$(Platform)\$(Configuration)\WinRTBridge.dll</HintPath>
</Reference>
</ItemGroup>
</Otherwise>
This code is responsable for that. Just build any project for wp8 copy Players folder to the root of your dll solution location, add add this lines of code to you dll's csproj file.
You will also need this
<Reference Include="UnityEngine">
<HintPath>UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>UnityEngine.UI.dll</HintPath>
</Reference>
<Reference Include="WinRTLegacy">
<HintPath>WinRTLegacy.dll</HintPath>
</Reference>
And you have to copy this 3 dll to you project location, not solution. What i'm trying to say here-just build anything for wp8 and study how unity wires up the dll, and try to repeat. !!Not works in unity5
Your answer
![](https://koobas.hobune.stream/wayback/20220613140144im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
What does Symlink Unity Libraries do? 5 Answers
Using a flash swc library when building for flash in 4.0 1 Answer
iOS MediaPlayer get songs in Audio like Android 0 Answers
help for static library 0 Answers