Augmented Reality (AR) tutorial for beginners using Unity 2022

preview_player
Показать описание
This is a step-by-step tutorial illustrating how to create an Augmented Reality (AR) app for an Apple iOS device or Android mobile phone or tablet, using the latest version of Unity 2022.

Augmented Reality is the technology you may have seen in games like Pokemon Go!, Harry Potter: Wizards Unite, Snapchat filters, or home design apps that let you superimpose virtual objects on a video feed that track the location of objects in the real world. Unlike QR codes or barcodes, I'll show you how you can use image tracking that will detect the texture of any flat object - a poster, the page of a book, an album cover - and place a new image, object, or movie on top of it.

Timings
---
00:00:00 - 00:03:05 Introduction and example applications
00:03:06 - 00:05:41 Downloading and installing Unity engine and modules
00:05:42 - 00:10:24 Creating and configuring the Unity AR project
00:10:25 - 00:12:36 Core components in an AR scene
00:12:37 - 00:15:16 The AR Tracked Image Manager
00:15:17 - 00:24:05 Adding custom functionality using C# script
00:24:06 - 00:26:26 Creating a simple AR gameobject prefab
00:26:27 - 00:27:34 Deploying the app to a device
00:27:35 - 00:30:35 Creating AR video clips or animated 3D models
00:30:36 - 00:32:10 Wrapup

Рекомендации по теме
Комментарии
Автор

It baffles me as to how this channel is the only one with good and easy to understand Unity Augmented Reality tutorials.
I remember watching your Vuforia tutorial about 3-4 years ago. Great stuff!

manofculture
Автор

honestly the best soft tutorial ive ever seen. short and straight to the point ! i love it

MM-yeog
Автор

The most structured and detailed tutorial i ca across until now. Thank you very much!

carmelchurchsatchiyapuram
Автор

honestly I work with unity for a few years now as a hobby. I never touched AR and I enjoyed your video a lot. Fully understandable. Continue this great job.

allaboutpaw
Автор

using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR.ARFoundation;
using UnityEngine.XR.ARSubsystems;


public class PlaceTrackedImages : MonoBehaviour
{
// Reference to AR tracked image manager component
private ARTrackedImageManager _trackedImagesManager;

// List of prefabs to instantiate - these should be named the same
// as their corresponding 2D images in the reference image library
public GameObject[] ArPrefabs;


private readonly Dictionary<string, GameObject> _instantiatedPrefabs = new Dictionary<string, GameObject>();
// foreach(var trackedImage in eventArgs.added){
// Get the name of the reference image
// var imageName =
// foreach (var curPrefab in ArPrefabs) {
// Check whether this prefab matches the tracked image name, and that
// the prefab hasn't already been created
// if (string.Compare(curPrefab.name, imageName, == 0
// &&
// Instantiate the prefab, parenting it to the ARTrackedImage
// var newPrefab = Instantiate(curPrefab, trackedImage.transform);
void Awake()
{
_trackedImagesManager =
}
private void OnEnable()
{
+= OnTrackedImagesChanged;
}
private void OnDisable()
{
-= OnTrackedImagesChanged;
}
private void eventArgs)
{
foreach (var trackedImage in eventArgs.updated)
{
// var imageName =
//foreach (var curPrefab in AreaEffector2DPrefabs)
// {
// if (string.Compare(curPrefab.name, imageName, == 0
// &&
// {
// var newPrefab = Instantiate(curPrefab, trackedImage.transform);
// = newPrefab;
// }
// }
// }
== TrackingState.Tracking);
}


foreach (var trackedImage in eventArgs.removed) {
// Destroy its prefab

// Also remove the instance from our array

// Or, simply set the prefab instance to inactive

}
}
}

aron_hoffman
Автор

Heres the code, exactly as it is in the video.

using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR.ARFoundation;
using UnityEngine.XR.ARSubsystems;


public class PlaceTrackedImages : MonoBehaviour {
// Reference to AR tracked image manager component
private ARTrackedImageManager _trackedImagesManager;

// List of prefabs to instantiate - these should be named the same
// as their corresponding 2D images in the reference image library
public GameObject[] ArPrefabs;

//Keep dictionary array of created prefabs
private readonly Dictionary<string, GameObject> _instantiatedPrefabs = new Dictionary<string, GameObject>();

void Awake() {
// Cache a reference to the Tracked Image Manager component
_trackedImagesManager =
}

void OnEnable() {
// Attach event handler when tracked images change
+= OnTrackedImagesChanged;
}

void OnDisable() {
// Remove event handler
-= OnTrackedImagesChanged;
}

// Event Handler
private void eventArgs) {

// Loop through all new tracked images that have been detected
foreach (var trackedImage in eventArgs.updated) {
// Get the ame of the referance image
var imageName =
// Now loop over the array of prefabs
foreach (var curPrefab in ArPrefabs) {
// Check wether this prefab matches the tracked image name, and that
// the prefab hasn't already been created
if (string.Compare(curPrefab.name, imageName, == 0
&& {
// Instantiate the prefab, parenting it to the ARTrackedImage
var newPrefab = Instantiate(curPrefab, trackedImage.transform);
// Add the created prefab to our array
= newPrefab;
}
}
}

// For all prefabs that have been created so far, set them active or no depending
// on whether their corresponding image is currectly being tracked
foreach (var trackedImage in eventArgs.updated) {

== TrackingState.Tracking);
}

// If the AR subsystem has given up looking for a tracked image
foreach (var trackedImage in eventArgs.removed) {
// Destroy its prefab

// Also remove the instance from our array

// Or, simply set the prefab instance to inactive

}
}
}

loadcartoons
Автор

This is so amazing. I can't thank you enough for providing an updated tutorial. I was getting so frustrated with my projects. Good luck to everyone!

annexgroup
Автор

Thank you for the tutorial. Glad to see that AR stack has progressed over time to be finally friendly.

vladislav
Автор

Fantastic! Your explanation for the C# segment is clear and surprisingly simple - thanks!

jamesmethven
Автор

This is awesome 👏🏼 As a XR teacher I will let my students make an AR gallery. Nice addition! As I planned to let them make a VR gallery already. Thanks a lot! I’ll support you.

pascalmariany
Автор

With your videos my learning curve will shrink drastically. Thank you.

a.kandemir
Автор

I am glad that there are people like you, who can help beginner streamers. Thank you brother, I appreciate your support. Always fresh updates

saviourmbong
Автор

Thank you so much for this tutorial! I had struggled through 5 other ones that were either out of date or broken in some way. This was so simple and friendly for an absolute Unity noob :) I'm going to use it to make AR christmas cards this year!

lanniekin
Автор

You got a like, a subscriber and a buzzer on from an old guy. TNice tutorials is the best soft soft tutorial I've seen so far. You covered a lot of

leonardusdandy.
Автор

I’ve watched hours of videos and tNice tutorials one is the first that explains it in a way a complete beginner could understand! Great video

senatorfabor
Автор

Very good as usual. Not something I'm interested in, but I enjoy the way you go in depth on topics, which is why I subscribe.
I hope you have more things like the big digit timer and Arduino/pi items. Love those. I'm sure you will. Cheers!

larrydom
Автор

I am SO happy you made this video. I've been hitting so many roadblocks lately

annexgroup
Автор

Thanks Alastair! This is brilliant. I will update as soon as I created my "AR Card Trick"!

allenwazny
Автор

Yo this helped so much and I always appreciate the content and when i found the channel and got the energy from you from the previous video, you've been nothing but real and can vouch for the amazing content and how down to earth you are with everything! All the most love, respect, and appreciation <3

kimnana
Автор

Can you continue with this series? This is the very first Unity ARFoundation tutorial I have followed that isn't insanely awful. This was great, it worked, its up to date, its logical, and it goes from beginning to end without skipping steps. Signed up for your Patreon.

luketechco
join shbcf.ru