Getting Started Unity3D
Prerequisites
You need following software:
- Unity with Pro license for the target platform, e.g. Android or iOS
- Android
- iOS
- metaioMobile unity package that is automatically installed with the metaio SDK
Getting Started
Create new Unity project
Create a new Unity project. Right click in the Project panel and select
Import Package->Custom Package to import metaioMobile package:
Once package has beeb imported, the following changes are required:
Add a user layer
Click on
Layers drop down at top-right corner of the Editor and select
Edit Layers.
Add a new layer in next available User Layer, e.g. call it "metaioLayer".
Change Build Settings
Go to
File->Build Settings, select Android or iOS. In the Inspector, select "Landscape Left" as default orientation for all platforms.
Click "
Other Settings" in the Inspector and set Bundle Identifier. This bundle identifier will be used to varify application signature (see next step).
Android
For Android, change the following as minimum requirement to run metaioMobile plugin:
- Set minimum API Level to 8 (Android 2.2 Froyo)
- Set ARMv7 only for Device Filter
- Set OpenGL ES 2.0 for Graphics Level
Set Application Signature
For each application identifer you need an unique signature. How to generate a signature is explained in this
FAQ.
After creating a signature, open the
ARScene under
metaio->Scenes. This is an example scene on how to use metaioMobile plugin.
Select
metaioMobile in the
Hierarchy panel and then in the Inspector view, set the
Application Signature.
Important: If an invalid application signature is provided, the plugin will fail to load.
Build and Run
Everything should be configured now, press "Build and Run" (or
CTRL+B if you prefer) to run it on the device.
The default tracking configuration will track the following pattern and display the famous
MetaioMan character:
iOS: Adding the library and necessary frameworks
After exporting the Unity project to Xcode, the Unity Unifeye Plugin has to be added to the project, as well as some external frameworks.
To do that, just drag the UnifeyeMobileUnity library right into Xcode:
After this is done, please add the following frameworks to the project:
- CoreMedia
- CoreVideo
- libxml2.dylib
- AVFoundation
If you push 'Run' the application will then link successfully and run on your device.
Adding new Tracking Configuration
Create the required tracking configuration. See
here for a guide.
Add
.bytes extension to all of tracking files (including images). For example, rename tracking.xml to tracking.xml.bytes, and image.png to image.png.bytes.
Import tracking files into
Resources/metaio directory.
Important: The above two steps should be exactly performed, otherwise the plugin will fail to load tracking data.
Click metaioMobile and in the Inspector view, set
Tracking Data to a xml file without .bytes extension, e.g. tracking.xml
Attach a new GameObject to the tracking pattern
Drag the desired GameObject into
metaioTracker (i.e. make it child). Select metaioTracker and in the Inspector view, set
COS ID that correspondes to a valid COS in the currently set tracking data.