Unity test and debug
Debugging AR Experiences#
Here are some tips for how to debug the ArDemo. For starters, when developing, changing the Logging Mode to Debug helps a lot, since it won’t filter the Debug.Logs created by the Appearition SDK. We highly recommend setting it to Debug for the sake of visibility.
Setup Common Mistakes#
Here is a list of the common mistakes and how to solve them.
Unrelated errors in the console#
It is important to note that errors in the console related to C#, such as null reference exception, index array out of range, missing reference exception, etc, cause the code execution to stop.
If your application has reached one of those errors prior to any other errors, fix it first.
No Profile Entered#
If no profile is entered in the AppearitionGate, the Unity Scene and compiled app, will be unable to communicate with the Appearition Platform. This exception can be picked up by the error in the console as shown above.
Vuforia License Key not entered / mismatch#
This type of error is caused by no license key entered in the VuforiaConfiguration file. Additionally, it will happen whenever the ArCamera shows only a black screen.
To fix this, simply head over to https://developer.vuforia.com and fetch your Vuforia App License Key again and enter it inside the App License Key field on the VuforiaConfiguration file.
Anonymous Token expired or mismatch#
This issue is most likely to occur upon getting the errors below:
The Ping service does not require an Application Token, but every other platform request is authorised only by a valid Application Token. If your Appearition Request fails please check your AppearitionGate details to ensure all values requested are correctly entered.
Vuforia not finding a device#
This case occurs when the ArCamera’s VuforiaBehaviour script has its WorldCenterMode set to Device, and you aren’t running the program on a mobile device.
By default, we recommend having it set to First Target.
Vuforia not enabled#
If you have imported the ArDemo sample project but forgot to turn on Vuforia, the console might give you something like the following:
In order to fix it, head to the Player Settings and turn it on. Refer to 1.1 Setting the Unity Editor for more information.
Target Not Found?#
No Target Image attached#
While this case scenario shouldn’t be possible when creating an Experience from the Portal, it can happen nonetheless when generating Data on the from your application.
Ensure that your Experience has a Target Image before continuing further.
Published or Unpublished#
Experiences have a published state which determine whether or not their data will be visible using the common API to fetch the Experiences data.
An unpublished Experience shows as greyed out in the Experience List, in the , like so:
In order to fix it, click on the Experience, go to the Status tab, and click on Publish. Upon success, the Target Image preview will look normal.
Image Recognition Syncing#
There is a chance that your Target Images are either not synced with your Image Recognition setup. Refer to First Run, Syncing with Vuforia Database to find more about how to sync Target Images with your Image Recognition on the .
Target found but where’s my Media?#
No media attached#
While it may sound silly, this has happened to us quite a few times; whereby we have an Experience with a Target Image but forgot to add at least one Media.
As part of diagnosing for the lack of Media, checking the is a must step. Refer to Content Setup for more information about how to setup Medias.
Zero scale / Quad Rotation#
Nearly all non-fullscreen Medias will be using the Translation, Rotation and Scale values. If any of the Scale value is zero, the object will most likely not be displayed properly.
Additionally, depending on the type of Media, if it is rendered on a single-sided mesh (like, a quad) and X or Y rotations are greater than +90 or smaller than -90, it will not be displayed properly.
In order to change that, head over to the Experience, edit the Media, and set the Scale value properly. Refer to Content Setup for more information about where to find those panels.
Application not fetching Asset data#
Ensure that that the Asset List is being fetched properly. In order to achieve that, ensure that the Logging Mode is set to Debug mode as shown in 3.0 – Debugging AR Experiences.
Having the Debug mode enabled, ensure that you get a similar log in the console:
These logs confirm that the experiences are fetched successfully. Prior to those logs, the live data isn’t on the application yet, and so cannot be displayed when the Target has been found by the AR Provider.