ARToolKit for Unity on Windows
From ARToolworks support library
Main Page > ARToolKit for Unity > ARToolKit for Unity on Windows
Contents |
Requirements
ARToolKit for Unity has a set of dependent DLLs which you must include along with any standalone app built for Windows. Please see below under "Deployment" for more detail.
Troubleshooting
Problem: You encounter an error like:(DllNotFoundException: [...]/Assets/Plugin/ARToolKitWrapper.dll(where [...] is the path to your Unity project)
Solution 1: Make sure you're running Unity Pro, and not the free or trial version. Unity Pro is required to run plugins.
Solution 2: In spite of the ARToolKitWrapper.dll clearly being in the referred to folder, the Unity Editor may not be able to find a required dependent DLL (i.e. a DLL on which the ARToolKitWrapper DLL depends). Confusingly, the dependent DLLs must be present in same folder as the .exe file of the host application (the Unity Editor, in this case), which is typically C:\Program Files (x86)\Unity\Editor. The required DLLs are normally (at least since ARToolKit for Unity v2.0.3) installed by the ARToolKit for Unity installer, but if you are having difficulty, you can double check. Check that the following are present in that folder:
- ARvideo.dll
- pthreadVC2.dll
- opencv_core220.dll
- opencv_flann220.dll
- DSVL.dll
- msvcr71.dll
- msvcp71.dll
Also required are the Visual Studio 2010 runtimes, although these must be installed into the Windows system.
Deployment
When deploying a standalone Unity application for Windows, you must also deploy the ARToolKit for Unity plugin's dependent DLLs. In this case, you should create an installer for your standalone app. Your installer, as well as installing your app's .exe file, also installs the required DLLs, including the Visual Studio 2010 runtimes. For your convenience, ARToolKit for Unity comes with a folder named "redist" which contains the required DLLs, plus the vc_redist.exe installer application which your installer must run to ensure that Visual Studio runtime libraries are available in the Windows system on the user's machine. The latter is an unfortunate requirement faced by all 3rd-party software for Windows.
If you have not deployed your standalone app with an installer before, we recommend the very functional and easy-to-learn installer InnoSetup. Once you have specified the other parts of your app which need to be installed, the required lines for an InnoSetup .iss file to install the DLLs would be something like:
[Files] Source: "{pf32}\ARUnity\redist\vcredist_x86.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "{pf32}\ARUnity\redist\ARvideo.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "{pf32}\ARUnity\redist\DSVL.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "{pf32}\ARUnity\redist\pthreadVC2.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "{pf32}\ARUnity\redist\msvcr71.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "{pf32}\ARUnity\redist\msvcp71.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "{pf32}\ARUnity\redist\opencv_core220.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "{pf32}\ARUnity\redist\opencv_flann220.dll"; DestDir: "{app}"; Flags: ignoreversion [Run] Filename: {app}\vcredist_x86.exe; Components: runtime; Parameters: "/passive /Q:a /c:""msiexec /qb /i vcredist.msi"" "; StatusMsg: Installing Visual Studio 2010 SP1 RunTime...
You might need to adjust the above if the path to your standalone's .exe is a subfolder of {app}.
Known Issues
If you have "Android" selected as the build target, the "Run" button in the Unity Editor may not correctly display your content. A workaround is to switch the build target to Windows, and then back to Android when you are ready to deploy.