Migrate
Migration notes for the Wikitude Unity Plugin
Migrate from 1.0.1 to 1.1.0
Version 1.1.0 contains many breaking changes to the plugin, so before upgrading, please backup your project, to prevent accidentally losing your work.
Wikitude classes are now concrete and sealed and expose Unity events to communicate. This means that now you can add them directly to game objects and subscribe to their events through the editor or at runtime in code. When adding subscribers to events, make sure you use the dynamic version of your method, when there is a choice between static and dynamic (please see the Client Recognition examples for more information on how to set up Client Trackers).
Values that were set in the inspector for these classes will need to be reset because of the change in class name and their internal representation.
The classes that previously derived from them will no longer work, so they need to be updated to receive events. On your game objects, you will get missing mono classes after updating. These should be replaced with the corresponding classes in the Wikitude plugin (Wikitude/Dependencies/WikitudeUnityPlugin) and the values need to be reintroduced.
All function names in Wikitude classes now begin with a capital letter.
When building for iOS, if you choose to append over a build made with a previous version, you will end up with two versions of the Wikitude plugin in your project, one located in Plugins/iOS and the new one in Plugins/Wikitude/iOS. Please make sure that only the new one is used. Alternatively, you can redo the build from scratch using the steps from the Setup Guide section.
Migration Example
This section will show how to migrate the example project from version 1.0.1 to work with the new version of the plugin.
(Optional)
Delete theDependencies
,Editor
andPlugins
folders. The plugin folder has changed drastically in this version. If you don't delete these folders, the correct files should still be replaced with the new version. However, the samples will not work correctly because magazine.wtc will be inStreamingAssets
folder instead ofStreamingAssets/Wikitude
. Since we won't be using the samples in this example, this step can be skipped.- Delete the
Wikitude/Samples
folder. TheSamples
folder is for illustration purposes only and is not needed in development. - Update
ClientTracker
script.Wikitude.IClientTracker
has been renamed toWikitude.ClientTracker
and is a sealed class. As such, theClientTracker
script should be changed to derive fromMonoBehaviour
instead and it's methods should be simple, instead of override. These methods will be set as callbacks in the Inspector. The class name should also be changed to avoid clashes with the Wikitude class. - Similar steps should be taken to update the
CloudTracker
script. Additionally, since it no longer derives fromWikitude.CloudTracker
, it will need a reference to it so that it can callStartContinuousRecognition
. - Similar steps should be taken to update the
SurferBehaviour
script. - Delete
MagazineTracker
,TrackableBehaviour
andWikitudeCamera
scripts. Since Wikitude classes are concrete now, they can be assigned directly to GameObjects, so there is no need for these empty classes anymore. - Open the scene called
main
from theScenes
folder. - Select the
WikitudeCamera
GameObject from the Hierarchy and enter your license key in the appropriate field in the Inspector. If the script is missing, add theWikitudeCamera
script from theDependencies/WikitudeUnityPlugin
dll. - Create a new GameObject and add the script you updated at step 3 to it.
- Select the
ClientTracker
GameObject from the Hierarchy and from theTarget Collection
dropdown selectmagazine.wtc
. Then, for each event you want to subscribe to, press the plus sign, set the GameObject created at step 9 to the fieldNone (Object)
and select the corresponding function callback. Please see Client Recognition examples for more information on how to work with Unity Events. - Select the
WikitudeEye
GameObject from the Hierarchy and add the script you updated at step 5 to it. - Select the
Trackable
GameObject from the Hierarchy and in theTarget Pattern
field enter * to track all targets. In the events foldout, subscribe the script you added to WikitudeEye to bothOn Enter Field Of Vision
andOn Exit Field Of Vision
events.
The project should now work as before.