From the SolarSystem example
I have created this amazing SolarSystem example using ARToolKit5. It is a great way to show how to bring Augmented Reality to life. With the release of ARToolKit6, I felt the need to update the example from ARToolKit5 to ARToolKit6. Let’s see what effort is involved in migrating the project. While developing on desktop you should use a good webcam.
Import the ARToolKit6.unitypackage
Let us just give it a try and import the ARToolKit6.unitypackage into the same project and see how it goes.
It seems like the package is going to be installed into the ARToolKit5-Unity directory. I’d have expected it to be installed into something named ARToolKit6
Let’s just hit Import
Yes, it looks like the ARToolKit6 scripts and libraries are imported next to the ARToolKit5 scripts and libraries. To be honest that seems to be a bit messy.

In addition to that we get a lot of errors:
I won’t continue that path. Let’s restart and clean out the ARToolKit5 assets and import ARToolKit6 into an ARToolKit5 free project.
Remove ARToolKit5 and start over
To clean everything out we remove:
- ARToolKit5-Unity directory
- Everything inside Plugins
I won’t remove the linkage of the scripts to the GameObjects at the moment. Just because I’d like to see where I had ARToolKit5 scripts attached to. I get some errors as well, but that is expected as I have references to ARToolKit5 scripts from my own scripts. Now let us import the ARToolKit6 plugin again.
2nd try to import ARToolKit6
That looks much better now. ARToolKit6 is going to be imported into a dedicated ARToolKit6 directory. That will give us a clean structure.
To see if the import worked we can quickly load the 2DTrackerTest scene and run it.
Aaarg, because of the usage of ARToolKit5 components in my scripts I cannot run the test scene even if they are not used in the test scene. That is not nice of Unity3D. As a quick workaround, I simply commented out all the code in my scripts and voila, the ARToolKit6 2DTrackerTest example scene runs perfectly.
Migrate the GameObjects
Now we can start to migrate the GameObjects to the new ARToolKit6 components. I open the solarSystem.scene again and start with the ARToolKit-GameObject. As expected we get some errors regarding missing scripts:
These were the ARMarker scripts which are not used any longer in ARToolKit6. As far as I know, these can be safely removed.
While we are inside the ARToolKit-GameObject we can check-out the ARController component which has changed quite a lot. In the section 2D Tracking Options we can set how many 2DTrackables we would like to track . Here I select three (Sun, Moon and Earth).
Next is ARSceneRoot, here we miss the ARToolKit5-script that was called ARSceneRoot . From the example scenes, we can see that ARToolKit6 has nothing like an ARSceneRoot so we can simply remove that component as well.
Now the actual trackables. In my case Sun, Earth and Moon. Each of this misses the AR Tracked Object component. In ARToolKit6 this component is now called ARTrackable2D. So we can go ahead removed this missing component from the Sun, Earth and Moon GameObject and drag an ARTrackable2D onto them.
Actually, on the Earth object, we had two AR Tracked Objects that is because I handle the event when this trackable was detected in two different scripts. But ARToolKit6 handles that differently. I’ll come back to that shortly.
Select the ARTrackable for ARToolKit6
Now that all our GameObjects are changed we need to select the actual trackable for the Sun, Moon and Earth object. To make ARToolKit6 recognize our trackables we need to move them into the StreaminAssets/ARToolKit/Images directory. (Recap: In ARToolKit5 the trackables were located directly in the StreamingAssets directory.)
Now we can select the trackable image for each GameObject from the dropDown in the ARTrackable component. All pretty straight forward so far.
Additional cleanup for ARToolKit6
ARToolKit6 does provide its own ARCamera because of that we need to remove the Main Camera from the scene.
Also, we need to drag the ARStaticARCamera script onto the ARToolKit-GameObject.
Event receiver system in ARToolKit6
Looks like the last missing link is to wire up the event receiver system so that our distance scripts can get into action when a trackable is in the camera’s field of view.
Selecting the Sun GameObject we can see a field for Event Receivers we set that to 1 and press enter. Now a selection field appears that lets us choose an event receiver script. So far so good, but how do we make our scripts be ARToolKit6-EventReceiver scripts?
Looking around in the available scripts we can see that there is something called AAREventReceiver looking at the script code of that component we see that this is an abstract class. Meaning that each script that implements AAREventReceiver is considered to be an event receiver for an ARTrackable script.
Let’s try that:
Open the distanceLine.cs script and make it inherit AAREventReceiver. While doing that we also rename all ARMarker classifiers to ARTrackable.
After compiling that script I only get the warning that we hide the inherited member functions. But we can get rid of that very easy by adding override public in front of that functions.
Removed properties from ARToolKit6
Tag property
Trying to build now leads to the error ARTrackable does not contain a definition for Tag … . Which is a bit of a nutcracker as I used this Tag to identify each specific marker.
The quickest solution I could come up with for that is to add a string property to the ARTrackable script (and to the ARTrackableEditor to make it visible) called trackableTag which I’m going to use in the same fashion.
Go ahead and replace all Tag occurrences with trackableTag in the distanceLine.cs
TrackedObject
The next challenge is the ARTrackedObject which was a property of the ARMarker script in ARToolKit5 but is not available in the ARTrackable script of ARToolKit6.
It looks like that got easier to use now because we can simply remove ARTrackedObject and use transform directly.
Running the project with ARToolKit6
As everything compiles now we can go ahead and press Play to actually run the scene.
Bang: The camera does not start Unable to start AR tracking… and we get an error about a missing Optical parameters directory (Error: can’t locate StreamingAssets/ARToolKit/Optical parameters’).
The second one is an easy fix. Just create an empty StreamingAssets/ARToolKit/Optical parameters directory.
The first issue troubled me a bit because I couldn’t come up with an idea what the cause could be. Finally, I compared the ARToolKit5 project with the ARToolKit6 project. Especially the ARToolKit-GameObject. There I found that the Video Configuration is completely different from ARToolKit5 to ARToolKit6 but somehow my project kept the ARToolKit5 settings. I replaced these settings with the settings from the ARToolKit6 example project and voila everything works.
Unity Layers
ARToolKit5 used different Layers to render AR-content. That is different for ARToolKit6. Make sure that after the migration all your AR-objects are rendered to Default-Layer.
You can have a look at the Unity project on GitHub
Summary of the migration steps from ARToolKit5 to ARToolKit6
- Remove ARToolKit5 assets from your project
- Import ARToolKit6
- Remove MainCamera and add ARStaticCamera
- Rework your event receiver and user AAREventReceiver
- Use ARTrackedObject instead of ARMarker
- Maybe you need to add a ‘Tag’ property to ARTrackable
- Fix the video configuration
- Make sure your 3D models are on the ‘Default’-Layer
That is about it. Thanks for reading that far and I hope it helps. Let me know your feedback and ask any questions in the comments below.
Hi, great tutorial. Thanks for the details.
I am working on Unity with ARToolkit6 and am able to successfully identify the marker and render 3D objects.
However, when the device camera is launched, it only launches in a fixed aspect ratio and does not cover the full screen of the device. How can I manage/change that? Would appreciate any help in this regard.
Thanks,
Div
On the ARToolKit component in you scenegraph in the inspector you can set the aspect ratio settings.
Hi,
Thanks for getting back to me.
I tried to add values to the Video Configuration part of AR Controller Script in Inspector for Android.
I used the value below:
-width=1920 -height=1080
Did not change anything. What am I missing.
Again, I appreciate the help.
Regards,
Div
Hi! I have a problen with Artoolkit 6 and I thought that maybe you can help me!
I want a canvas with text and buttons, to appear in the marker when I track it with my phone. The point is that the canvas needs to be linked with a camera (render mode = world space), but I dont have any camera as object, like in Atoolkit5.
Can anyone help me??
Thanks!!!
I might be able to help. However, I need more details.
Which platform are you using? Do you have any log output?
Hello, where can I download the necessary files for ARtoolkit6? as I can’t seem to find any links on Artoolkit.org.
thanks for your Help and Beautiful work on this website.
Hi, which version and package are you after. I’ve some still available on my machine.
Hello, mr. Bux.
I am making an Android AR app in the company I work and I plan to migrate to ARToolKit 6 (Java, non-Unity). But there is a problem. Configuring the AR scene, I have to get camera parameters, and apparently I can’t access the ARActivity.getCameraPreview() method. Actually, I seemed to think that such method was removed, but it turns out that the method is showed in the Docs. Could you help me with this question?
If it’s ok to you, I would like to ask too something less necessary. Is there any possibility to integrate ARToolKit with the CameraView funcionality by Google for Android. I believe the current method would likely get the frame from the camera and then render the 3d objects. Would it work if I used basically this approach in CameraView?
Thank you for your time.
Best regards,
Arthur
Hello Mr. Bux,
Great blog. But I am not able to find the latest ARToolKit6 unity package. Can you please help find the link? The one which I found is not working. https://artoolkit.org/download.html
Is Artoolkit still working? The page is down for a while.
look at artoolkitx.org the project is continued there. The artoolkit.org from DAQRI seems to be dead.
Dear Thor_bux
Thank you very much for your site and tutorials. They are very helpfull!
I’m trying to make your github project work in unity, but I keep geeting the same error and I’ve been looking all over the internet for solutions. I know it’s related to the native plugin functions and their relation to AR6.bundle in plugins, but I cannot fix the error which seems simple to solve. Could you possibly help. I want to use your example with modifications for a group of architecture students.
The error is:
DllNotFoundException: AR6
PluginFunctions.arwInitialiseAR (Int32 pattSize, Int32 pattCountMax) (at Assets/ARToolKit-Unity/Scripts/System/PluginFunctions.cs:80)
It seems it cannot find the AR6 file inside the AR6.bundle directory in relation to ARNativePlugin and its methods.
I’m on windows in unity 2017.4.0f1 trying to build for android
Thank you very much!
Thomas
Unfortunately, ARToolKit6 does not support Unity on Windows. You should be able to build an Android .apk but you can’t run the scene inside the Editor on a Windows machine.
Dear Thorsten
Thank you for your reply, I had a suspicion. 🙂
I already moved to ARUnity5 instead and implemented you great tutorial for high resolution video on android and everything is running smoothly after some tweaking. I’m also following ARToolkitx with great expectations. Thank you again for your time!
Thomas