XR For Unity — 2 — Augmented Reality

Samuel Asher Rivello
4 min readSep 18, 2024

--

I am Samuel Asher Rivello, a professional game developer with 25 years of game development experience including 10+ years with the Unity game engine. Unity is a powerful and popular suite of tools (Project IDE, Code IDE, and run-time).

Unity For XR

Unity 6 builds upon the strengths of its predecessors while introducing groundbreaking features that elevate the game development process. Unity 6 also offers deeper integration with modern hardware, making it easier to optimize games for cutting-edge platforms like AR, VR, and XR.

XR Technologies

XR Technologies

Extended reality (XR) is the umbrella under which we find AR, VR, and MR technologies. These are the new realities.

  • Augmented Reality (AR) — Layers computer generated imagery on top of the users view of the real world. Typically the user looks through a mobile phone’s live camera feed or the user wears Ar glasses. The included software may rely on SLAM.
  • Virtual Reality (VR) — Replaces (blocks) the users real world view with a completely digital surroundings. The input can vary, but generally includes at least 6 degrees of head tracking (positions & rotations). Typically the user wears goggles.
  • Mixed Reality (MR) — Blends AR and VR concepts into the user’s environment. Think of a 3D tooltips hovering over real world objects that respect the position, scale, and movement of the objects.
AR Games

Unity For Gaming

Unity has long been a cornerstone of the game development industry, providing developers with a versatile and powerful engine capable of delivering experiences across multiple platforms.

With a user-friendly interface, a massive asset store, and a thriving community, Unity has enabled indie developers and large studios alike to create stunning games without the need for massive budgets or teams.

Augmented Reality For Unity

Setting up Augmented Reality (AR) in Unity has become increasingly efficient thanks to Unity’s AR Foundation. AR Foundation is a powerful framework that allows developers to build cross-platform AR experiences for devices such as iOS (via ARKit) and Android (via ARCore). This flexibility enables a single codebase to run on multiple platforms, simplifying the development process.

AR Foundation

To start, developers need to install the AR Foundation package from the Unity Package Manager. Once installed, AR Foundation provides a set of components that manage the camera, environment tracking, and user input. The next step is to choose the target platform (iOS or Android) and install the corresponding ARKit or ARCore packages. Unity includes prefabs and templates that help get projects off the ground quickly, such as AR Session Origin, which ensures correct positioning of virtual objects in the real world.

Best Practices for AR Development

Augmented Reality development introduces a unique set of challenges that require specific best practices to ensure the experience is engaging and functional. One critical factor is anchoring virtual objects to the physical world. AR Foundation’s plane detection feature allows virtual objects to interact with surfaces like tables or floors, but it’s crucial to ensure these objects remain stable and accurate as the user moves their device.

https://learn.unity.com/

User experience is also key in AR. The interface should be intuitive, and interactions such as object manipulation (scaling, rotating, and moving) should feel natural and responsive. Additionally, since AR applications are often used on mobile devices, optimizing performance and battery life is essential. Unity’s Profiler and built-in optimization tools help developers fine-tune their applications, ensuring smooth performance across various devices.

Resources

🦜 Contact

  • Samuel Asher Rivello has over 20 years of game dev XP. He is available for remote, contract hire as a game developer and game dev educator.
  • Contact Sam today to say hi and discuss your projects!

📜 Articles

🛜 Downloads

--

--

Samuel Asher Rivello

Game Developer & Instructor - Unity Certified. 20+ years of game dev XP. Available For Remote Hire. http://www.SamuelAsherRivello.com