Search⌘ K

Part 2: Create Your First AR App

Explore how to create an AR app by scripting in C# within Unity and AR Foundation. Learn to spawn 3D assets using prefab placement, add animation controllers, and prepare your app for Android testing. This lesson equips you with practical skills to develop interactive AR experiences using Unity's Asset Store and AR Placement techniques.

In this lesson, we'll explore C# scripting and how it can enhance our AR Placement functionality. We will learn how to write a C# script that enables us to spawn a Prefab when we click the center of the screen, triggered by the “Tap to Place” indicator. We'll also explore the vast Asset Store and discover how to add a captivating 3D asset to our AR scene. We'll have the opportunity to convert an animated character into a reusable Prefab. By the end of this lesson, we will have the knowledge and skills to bring our AR app to life with interactive placement, stunning 3D assets, and captivating animations. Let’s dive in and continue building our AR app.

Scripting

We'll start by adding an empty GameObject to our hierarchy and naming it Controller. This GameObject will serve as the container for our AR Placement functionality. Next, we'll create a new script called ARPlacement and attach it to the Controller GameObject.

The ARPlacement script will contain the necessary code to handle the placement of AR objects in our scene. To ensure clarity ...