Unity ARKit By Example: Part 2

  1. In Unity, We create a new folder, Assets > Scenes, and create a new scene in it, e.g., Hello World
  2. We modify the Main Camera; setting the Transform > Position to (0, 0, 0) and Camera > Clear Flags to Depth only
  3. We add the Unity AR Video script to the Main Camera. We then set Unity AR Video > Clear Material to Assets > UnityARKitPlugin > Plugins > iOS > UnityARKit > Materials > YUVMaterial
  4. We add the Unity AR Camera Near Far script to the Main Camera
  5. We create a new empty GameObject, e.g., ARCameraManager, and add the Unity AR Camera Manager script to it. We set Unity AR Camera Manager > Camera to the Main Camera
  6. We add the prefab, Assets > UnityARKitPlugin > ARKitRemote > ARKitRemote, to the scene
  • Transform: (0, 0, 2)
  • Scale: (0.3, 0.3, 0.3)
  • Rotation: (0, 45, 0)
  • It is important to size the Game pane to the same aspect ratio of a portrait iOS device; otherwise the cube will be distorted
  • Change the bundle identifier to something unique to your application; in my case com.larkintuckerllc.hellounityarkit
  • Make sure to only include the Hello World scene in the build
  • The night before, I happened to run the application in pitch black. Under these conditions, the cube would dance around the room. Guess this makes sense as the application has nothing to orient to
  • Into the Hello World scene, we create a UI > Image GameObject; used as a background
  • We create an Text GameObject in the Canvas GameObject (automatically created along with the Image GameObject); renaming it PointCount
  • We set PointCount’s default text to 0 and alignment to center
  • The EventSystem GameObject is also automatically created along with the Image GameObject
  • The integration with Unity-ARKit-Plugin is the single line in the Start method; subscribes a method to the ARFrameUpdatedEvent
  • We use the flag _pointCountUpdated, to only update the text in the Update method after the point count is updated
  • Observe that when we focus the iOS device on a distant wall (left), ARKit detects few (2) points
  • When focused on a near scene with a number of objects, ARKit detects many (149) points



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
John Tucker

John Tucker


Broad infrastructure, development, and soft-skill background