Skip to content
Matt Harley edited this page Jan 25, 2015 · 10 revisions

Getting Started with Metaio on Unity

Version: metaioSDK-5.5.2

Tutorial Video Notes

Main Tutorial

https://dev.metaio.com/webinars/metaio-sdk-unity-fundamentals/

  • What's different?
    • References http://docs.metaio.com/bin/login/Main/MobileGettingStartedUnity which I need a login for!
    • Folders in Project tab under Assets:
    • Resources director no longer has image and tracking data
    • There's no Scenes directory
    • The stuff about making the tracking XML is no longer valid. Tracking assets are now under Assets > StreamingAssets > *.xml
  1. Register you app at http://my.metaio.com/index.php?state=portal (e.g. Unity Test, 'com.felixlab.unitytest'). This will give you a n
  2. Select your app in the top panel and then select the SDK Signature from the lower panel. (e.g. WYiJpNgSp5BSh1MzmaHxRggQFFzm3FpQ4ND9XCVjrk0=)
  3. In Unity, go to File > Build Settings and in both the iOS and Android under Other Settings, change the Bundle Identifier to your app identifier above (e.g. 'com.felixlab.unitytest')
  4. (optional) They also change the Default Orientation to Landscape Left
  5. In the Heirarchy tab, click metaioSDK. This should open the MetaioSDK properties in the Inspector tab
  6. There should be an SDK Signature box where you need to paste in your SDK Signature from above (e.g. WYiJpNgSp5BSh1MzmaHxRggQFFzm3FpQ4ND9XCVjrk0=). You can also access this from Project under Assets > StreamingAssets > MetaioSDKLicense.xml
  7. You should be all good to go. Go back to File > Build Settings, select your app platform (iOS or Android) and click Build. I've exported mine as ExampleApp

iOS

https://dev.metaio.com/storage-folder/getting-started/unity3d/creating-new-ar-application/

  1. Open ExampleApp/Unity-iPhone.xcodeproj
  2. Drag the file ExampleApp/Libraries/metaiosdk into the root of your new Xcode project
  3. You'll need to add some extra libraries
  4. Click on the root of your project (Unity-iPhone)
  5. Open the Unity-iPhone Target by clicking in the top-left corner of the Editor window and selecting Unity-iPhone under Targets rather than Projects
  6. Then click on Build Phases, expand Link Binaries with Libraries and add:
  • libxml2.2dylib
  • Security.framework
  • CoreImage.framework
  1. You should be all good to go. Hit build and run!

Advanced Tutorial I

http://dev.metaio.com/webinars/metaio-sdk-unity-advanced/

  • What's different?
    • There is no default ARScene included in the SDK unity package. You'll need to start a new scene, add the metaioSDK and metaioTracker` prefabs and then save the scene (as ARScene if you like)

Other Advanced Tutorials

http://dev.metaio.com/webinars/metaio-sdk-unity-advanced-ii/ https://dev.metaio.com/webinars/unity-advance-interactions-with-the-metaio-sdk/

Free Models for Unity

Main Menu

Creating a menu in Unity (starting from the example).

  • For testing - you can either press the play button on the Unity GUI or use the desktop build option (File > Build Settings > PC, Mac, Linux Standalone)
  • Can't use HTML to create menus!! (bummer)
  • http://docs.unity3d.com/Manual/gui-Basics.html
  • Declaring a GUIStyle creates a panel in the Unity Inspector which you can edit. (e.g. public GUIStyle TutorialHelloWorldPreview;). To find this panel in Unity, go to the Hierarchy panel (left of screen) and select "GUI" - as opposed to "Main Camera"
  • Changing the main menu text colour: Headline Text Style > Normal > Text Color
  • Changing the icon for each tutorial. I went to Tutorial Hello World Preview > Normal > Background and drag and dropped the image file from Assets down the bottom in the Project pane
  • You can move objects around by changed the values given in the Rect(left, top, width, height) constructor in MainMenu.cs

Adding Levels To A Build

  • If you trying to open a level and get the error: Level couldn't be loaded because it has not been added to the build settings, you need to add the level to the build settings (obviously). But how?
  • Open the level under Project -> Assets and locate the .unity file (it has the Unity icon)
  • Open File -> Build Settings and drag the unity file icon into the Scenes In Build panel

Videos with Alpha layer

  • Make sure you rename the video file to include *.alpha.* in the filename. E.g. myvideo.alpha.3g2

Debugging

http://unitygems.com/debugging-game-monodevelop/

Unpacking Metaio files from a split binary on Android (e.g. obb files)

  1. Get a list of all files in the StreamingAssets folder:
$ cd blah/UnityProject/Assets/StreamingAssets
$ find . | grep -v 'meta'
./MainMenu
./MetaioSDKLicense.xml
./TutorialContentTypes
...
  1. Remove the leading . to make the paths like this: /MainMenu