Augmented Reality (AR) tutorial for beginners using Unity 2022

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 พ.ย. 2024

ความคิดเห็น • 587

  • @loadcartoons
    @loadcartoons ปีที่แล้ว +55

    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;
    [RequireComponent(typeof(ARTrackedImageManager))]
    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 _instantiatedPrefabs = new Dictionary();

    void Awake() {
    // Cache a reference to the Tracked Image Manager component
    _trackedImagesManager = GetComponent();
    }
    void OnEnable() {
    // Attach event handler when tracked images change
    _trackedImagesManager.trackedImagesChanged += OnTrackedImagesChanged;
    }
    void OnDisable() {
    // Remove event handler
    _trackedImagesManager.trackedImagesChanged -= OnTrackedImagesChanged;
    }

    // Event Handler
    private void OnTrackedImagesChanged(ARTrackedImagesChangedEventArgs 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 = trackedImage.referenceImage.name;
    // 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, StringComparison.OrdinalIgnoreCase) == 0
    && !_instantiatedPrefabs.ContainsKey(imageName)) {
    // Instantiate the prefab, parenting it to the ARTrackedImage
    var newPrefab = Instantiate(curPrefab, trackedImage.transform);
    // Add the created prefab to our array
    _instantiatedPrefabs[imageName] = 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) {
    _instantiatedPrefabs[trackedImage.referenceImage.name]
    .SetActive(trackedImage.trackingState == TrackingState.Tracking);
    }
    // If the AR subsystem has given up looking for a tracked image
    foreach (var trackedImage in eventArgs.removed) {
    // Destroy its prefab
    Destroy(_instantiatedPrefabs[trackedImage.referenceImage.name]);
    // Also remove the instance from our array
    _instantiatedPrefabs.Remove(trackedImage.referenceImage.name);
    // Or, simply set the prefab instance to inactive
    //_instantiatedPrefabs[trackedImage.referenceImage.name].SetActive(false);
    }
    }
    }

  • @aron_hoffman1521
    @aron_hoffman1521 2 ปีที่แล้ว +266

    using System;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.XR.ARFoundation;
    using UnityEngine.XR.ARSubsystems;
    [RequireComponent(typeof(ARTrackedImageManager))]
    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 _instantiatedPrefabs = new Dictionary();
    // foreach(var trackedImage in eventArgs.added){
    // Get the name of the reference image
    // var imageName = trackedImage.referenceImage.name;
    // 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, StringComparison.OrdinalIgnoreCase) == 0
    // && !_instantiatedPrefabs.ContainsKey(imageName)){
    // Instantiate the prefab, parenting it to the ARTrackedImage
    // var newPrefab = Instantiate(curPrefab, trackedImage.transform);
    void Awake()
    {
    _trackedImagesManager = GetComponent();
    }
    private void OnEnable()
    {
    _trackedImagesManager.trackedImagesChanged += OnTrackedImagesChanged;
    }
    private void OnDisable()
    {
    _trackedImagesManager.trackedImagesChanged -= OnTrackedImagesChanged;
    }
    private void OnTrackedImagesChanged(ARTrackedImagesChangedEventArgs eventArgs)
    {
    foreach (var trackedImage in eventArgs.updated)
    {
    // var imageName = trackedImage.referenceImage.name;
    //foreach (var curPrefab in AreaEffector2DPrefabs)
    // {
    // if (string.Compare(curPrefab.name, imageName, StringComparison.OrdinalIgnoreCase) == 0
    // && !_instantiatedPrefabs.ContainsKey(imageName))
    // {
    // var newPrefab = Instantiate(curPrefab, trackedImage.transform);
    // _instantiatedPrefabs[imageName] = newPrefab;
    // }
    // }
    // }
    _instantiatedPrefabs[trackedImage.referenceImage.name].SetActive(trackedImage.trackingState == TrackingState.Tracking);
    }
    foreach (var trackedImage in eventArgs.removed) {
    // Destroy its prefab
    Destroy(_instantiatedPrefabs[trackedImage.referenceImage.name]);
    // Also remove the instance from our array
    _instantiatedPrefabs.Remove(trackedImage.referenceImage.name);
    // Or, simply set the prefab instance to inactive
    //_instantiatedPrefabs[trackedImage.referenceImage.name].SetActive(false);
    }
    }
    }

    • @bceg3961
      @bceg3961 2 ปีที่แล้ว +5

      Ty!

    • @madcowboy5700
      @madcowboy5700 2 ปีที่แล้ว +5

      legend

    • @phananhvu1930
      @phananhvu1930 2 ปีที่แล้ว +3

      legend

    • @leifdavisson6409
      @leifdavisson6409 2 ปีที่แล้ว +4

      Unity.Tutorials.Core.Editor.BuildStartedCriterion must be instantiated using the ScriptableObject.CreateInstance method instead of new BuildStartedCriterion.
      UnityEngine.ScriptableObject:.ctor ()
      Unity.Tutorials.Core.Editor.Criterion:.ctor ()
      Unity.Tutorials.Core.Editor.PreprocessBuildCriterion:.ctor ()
      Unity.Tutorials.Core.Editor.BuildStartedCriterion:.ctor ()
      UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
      Unity.Tutorials.Core.Editor.BuildStartedCriterion must be instantiated using the ScriptableObject.CreateInstance method instead of new BuildStartedCriterion.
      UnityEngine.ScriptableObject:.ctor ()
      Unity.Tutorials.Core.Editor.Criterion:.ctor ()
      Unity.Tutorials.Core.Editor.PreprocessBuildCriterion:.ctor ()
      Unity.Tutorials.Core.Editor.BuildStartedCriterion:.ctor ()
      UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
      [ServicesCore]: To use Unity's dashboard services, you need to link your Unity project to a project ID. To do this, go to Project Settings to select your organization, select your project and then link a project ID. You also need to make sure your organization has access to the required products. Visit dashboard.unity3d.com to sign up.
      UnityEngine.Logger:LogWarning (string,object)
      Unity.Services.Core.Internal.CoreLogger:LogWarning (object) (at Library/PackageCache/com.unity.services.core@1.5.2/Runtime/Core.Internal/Logging/CoreLogger.cs:15)
      Unity.Services.Core.Editor.ProjectUnlinkBuildWarning:OnPreprocessBuild (UnityEditor.Build.Reporting.BuildReport) (at Library/PackageCache/com.unity.services.core@1.5.2/Editor/Core/Build/ProjectUnlinkBuildWarning.cs:29)
      UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
      MissingTextureException: Exception of type 'UnityEditor.XR.ARCore.ArCoreImg+MissingTextureException' was thrown.
      UnityEditor.XR.ARCore.ArCoreImg.CopyTo (UnityEngine.XR.ARSubsystems.XRReferenceImage referenceImage, System.String destinationDirectory) (at Library/PackageCache/com.unity.xr.arcore@4.2.7/Editor/ArCoreImg.cs:147)
      UnityEditor.XR.ARCore.ArCoreImg+d.MoveNext () (at Library/PackageCache/com.unity.xr.arcore@4.2.7/Editor/ArCoreImg.cs:156)
      System.String.Join (System.String separator, System.Collections.Generic.IEnumerable`1[T] values) (at :0)
      UnityEditor.XR.ARCore.ArCoreImg.ToImgDBEntry (UnityEngine.XR.ARSubsystems.XRReferenceImage referenceImage, System.String destinationDirectory) (at Library/PackageCache/com.unity.xr.arcore@4.2.7/Editor/ArCoreImg.cs:163)
      UnityEditor.XR.ARCore.ArCoreImg.ToInputImageListPath (UnityEngine.XR.ARSubsystems.XRReferenceImageLibrary library, System.String destinationDirectory) (at Library/PackageCache/com.unity.xr.arcore@4.2.7/Editor/ArCoreImg.cs:171)
      UnityEditor.XR.ARCore.ArCoreImg.BuildDb (UnityEngine.XR.ARSubsystems.XRReferenceImageLibrary library) (at Library/PackageCache/com.unity.xr.arcore@4.2.7/Editor/ArCoreImg.cs:97)
      UnityEditor.XR.ARCore.ARCoreImageLibraryBuildProcessor.BuildAssets () (at Library/PackageCache/com.unity.xr.arcore@4.2.7/Editor/ARCoreImageLibraryBuildProcessor.cs:37)
      Rethrow as Exception:
      -
      -
      -
      Error building XRReferenceImageLibrary Assets/ReferenceImageLibrary.asset: XRReferenceImage named '' is missing a texture.
      -
      -
      -
      UnityEditor.XR.ARCore.ARCoreImageLibraryBuildProcessor.Rethrow (UnityEngine.XR.ARSubsystems.XRReferenceImageLibrary library, System.String message, System.Exception innerException) (at Library/PackageCache/com.unity.xr.arcore@4.2.7/Editor/ARCoreImageLibraryBuildProcessor.cs:16)
      UnityEditor.XR.ARCore.ARCoreImageLibraryBuildProcessor.BuildAssets () (at Library/PackageCache/com.unity.xr.arcore@4.2.7/Editor/ARCoreImageLibraryBuildProcessor.cs:41)
      UnityEditor.XR.ARCore.ARCoreImageLibraryBuildProcessor.UnityEditor.Build.IPreprocessBuildWithReport.OnPreprocessBuild (UnityEditor.Build.Reporting.BuildReport report) (at Library/PackageCache/com.unity.xr.arcore@4.2.7/Editor/ARCoreImageLibraryBuildProcessor.cs:74)
      UnityEditor.Build.BuildPipelineInterfaces+c__DisplayClass16_0.b__1 (UnityEditor.Build.IPreprocessBuildWithReport bpp) (at :0)
      UnityEditor.Build.BuildPipelineInterfaces.InvokeCallbackInterfacesPair[T1,T2] (System.Collections.Generic.List`1[T] oneInterfaces, System.Action`1[T] invocationOne, System.Collections.Generic.List`1[T] twoInterfaces, System.Action`1[T] invocationTwo, System.Boolean exitOnFailure) (at :0)
      UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
      Error building Player: MissingTextureException: Exception of type 'UnityEditor.XR.ARCore.ArCoreImg+MissingTextureException' was thrown.
      Build completed with a result of 'Failed' in 0 seconds (429 ms)
      UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
      UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
      at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002da] in :0
      at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in :0
      UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

    • @abhijiths7907
      @abhijiths7907 2 ปีที่แล้ว

      Thankyou my man

  • @luketechco
    @luketechco 2 ปีที่แล้ว +155

    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.

    • @scar3-ie237
      @scar3-ie237 2 ปีที่แล้ว +1

      I wish he would continue too !

    • @feitingschatten1
      @feitingschatten1 2 ปีที่แล้ว +4

      Most of what you'd do isn't specific to AR. Physics triggers, scenes, raycasts, all basic Unity stuff.

    • @Tropicaya
      @Tropicaya ปีที่แล้ว

      @@feitingschatten1 exactamundo

    • @timeforrice
      @timeforrice 10 หลายเดือนก่อน

      Would love to see more of this as well.

  • @manofculture8666
    @manofculture8666 2 ปีที่แล้ว +8

    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!

  • @alguembonitinho
    @alguembonitinho 2 ปีที่แล้ว +53

    Scripity of the video above is here
    :]
    using System;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.XR.ARFoundation;
    using UnityEngine.XR.ARSubsystems;
    [RequireComponent(typeof(ARTrackedImageManager))]
    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 _instantiatedPrefabs = new Dictionary();
    // foreach(var trackedImage in eventArgs.added){
    // Get the name of the reference image
    // var imageName = trackedImage.referenceImage.name;
    // 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, StringComparison.OrdinalIgnoreCase) == 0
    // && !_instantiatedPrefabs.ContainsKey(imageName)){
    // Instantiate the prefab, parenting it to the ARTrackedImage
    // var newPrefab = Instantiate(curPrefab, trackedImage.transform);
    void Awake()
    {
    _trackedImagesManager = GetComponent();
    }
    private void OnEnable()
    {
    _trackedImagesManager.trackedImagesChanged += OnTrackedImagesChanged;
    }
    private void OnDisable()
    {
    _trackedImagesManager.trackedImagesChanged -= OnTrackedImagesChanged;
    }
    private void OnTrackedImagesChanged(ARTrackedImagesChangedEventArgs eventArgs)
    {
    foreach (var trackedImage in eventArgs.updated)
    {
    // var imageName = trackedImage.referenceImage.name;
    //foreach (var curPrefab in AreaEffector2DPrefabs)
    // {
    // if (string.Compare(curPrefab.name, imageName, StringComparison.OrdinalIgnoreCase) == 0
    // && !_instantiatedPrefabs.ContainsKey(imageName))
    // {
    // var newPrefab = Instantiate(curPrefab, trackedImage.transform);
    // _instantiatedPrefabs[imageName] = newPrefab;
    // }
    // }
    // }
    _instantiatedPrefabs[trackedImage.referenceImage.name].SetActive(trackedImage.trackingState == TrackingState.Tracking);
    }
    foreach (var trackedImage in eventArgs.removed) {
    // Destroy its prefab
    Destroy(_instantiatedPrefabs[trackedImage.referenceImage.name]);
    // Also remove the instance from our array
    _instantiatedPrefabs.Remove(trackedImage.referenceImage.name);
    // Or, simply set the prefab instance to inactive
    //_instantiatedPrefabs[trackedImage.referenceImage.name].SetActive(false);
    }
    }
    }

    • @DindaArt
      @DindaArt ปีที่แล้ว +1

      Thanks! I couldn’t find it anywhere! I was feeling scammed haha

    • @eproyectos7730
      @eproyectos7730 ปีที่แล้ว

      Thanks!

    • @NotFlan
      @NotFlan ปีที่แล้ว +3

      Just curious, why is everything after
      private readonly Dictionary _instantiatedPrefabs = new Dictionary();
      and
      OnTrackedImagesChanged
      commented out, whereas its not in the video?

    • @anastasiaporunova7440
      @anastasiaporunova7440 ปีที่แล้ว

      @@DindaArt is this script working?

    • @esmeemarch612
      @esmeemarch612 ปีที่แล้ว

      I love you. Thanks!

  • @IlanPerez
    @IlanPerez 8 หลายเดือนก่อน +2

    after watch the first 2 minutes of this video I am so excited to dig in.

  • @jodexcreates
    @jodexcreates 2 ปีที่แล้ว +9

    For those having an issue with the script compiling, try making sure the class name in the CS file is the same exact name as the CS file, casing and all.

    • @bruhbeat3047
      @bruhbeat3047 2 ปีที่แล้ว

      .cs on the name to??, it didn't let me add it, got an error saying,"The associated script can not be loaded. Please fix any compile error and assign a valid script"

    • @jodexcreates
      @jodexcreates 2 ปีที่แล้ว

      @@bruhbeat3047 no, don't include the ".cs" part in the script class name. Just put the name that's in front. If you still have an error, then it's probably a different syntax error so go through the code again and see if you have anything missing or in a wrong format.

    • @user-rj1hx3gw2b
      @user-rj1hx3gw2b 2 ปีที่แล้ว

      how I can get the script file please

    • @bruhbeat3047
      @bruhbeat3047 2 ปีที่แล้ว +2

      @@user-rj1hx3gw2b if you open the description of the video you'll see the link to his paterion, hit that and scroll down to the thumb nail of this video it's linked there,
      Btw I've just been helping people in the comments just look around and you should be able to find other people's that I helped with 👍

    • @lste1868
      @lste1868 ปีที่แล้ว +2

      king

  • @MM-ye7og
    @MM-ye7og 2 ปีที่แล้ว +2

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

  • @trexnfabianndenis
    @trexnfabianndenis ปีที่แล้ว +1

    I started out with an escape room and now i'm back in school studying electronics-IT.. All thanks to your videos my friend 🙏

    • @PlayfulTechnology
      @PlayfulTechnology  ปีที่แล้ว

      Oh wow - that's so awesome to hear!

    • @opafritzsche
      @opafritzsche หลายเดือนก่อน

      @@PlayfulTechnology any way to do this for PC apps and non mobile Platforms ?

  • @annexgroup6878
    @annexgroup6878 2 ปีที่แล้ว +10

    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!

    • @junjun3987
      @junjun3987 ปีที่แล้ว

      have you got it?

    • @ab_obada5012
      @ab_obada5012 ปีที่แล้ว +1

      @@junjun3987 he does not because it is dumb to copy code without to write it and explain it at same time

  • @allaboutpaw9396
    @allaboutpaw9396 2 ปีที่แล้ว

    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.

  • @sairapabraham4251
    @sairapabraham4251 2 ปีที่แล้ว +13

    where can I get the C#script for place tracked image ?

    • @fin4314
      @fin4314 2 ปีที่แล้ว +1

      Go to the Patreon of the channel - you can find the code there even if you're not a supporter

  • @a.kandemir4342
    @a.kandemir4342 2 ปีที่แล้ว +1

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

  • @loreleipepi3389
    @loreleipepi3389 ปีที่แล้ว +2

    Thanks for the excellent tutorial! Like many others, I use iOS and have had the black screen and Unity crashing issues. Some people suggest that it's resolvable with activating and updating the ARKit /ARCore. Mine were already in place and updated, and it wasn't until I downloaded and imported the entire Unity AR Foundation package that I was able to do image tracking and have the camera work. They have samples built in to the Foundation package. There are a lot more scripts!

  • @pascalmariany
    @pascalmariany 2 ปีที่แล้ว +1

    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.

  • @annexgroup6878
    @annexgroup6878 2 ปีที่แล้ว

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

  • @lanniekin
    @lanniekin 2 ปีที่แล้ว +6

    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!

  • @henrikjorgensen6850
    @henrikjorgensen6850 2 ปีที่แล้ว +7

    Hello Playful Technology
    Great dowen to earth video, perfekt tempo.
    I made the app and it runs perfectly, the camera it's starting normally on the app at my mobile device (Samsung s21), but when I point it to the anchor image, nothing happends, the 3D object does not appear above it. Can you help me/us

    • @thiago_vball
      @thiago_vball ปีที่แล้ว

      same

    • @ED-nj9uo
      @ED-nj9uo ปีที่แล้ว

      ave you found a solution by any chance?
      The same thing happens to me

  • @vladislav4797
    @vladislav4797 2 ปีที่แล้ว

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

  • @senatorfabor8071
    @senatorfabor8071 2 ปีที่แล้ว

    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

  • @henryqng
    @henryqng 2 ปีที่แล้ว +4

    I watched many AR tutorial on TH-cam, but most of them were outdated or hard to understand. Thanks for this detailed Unity AR tutorial. I have just liked and subscribed to your channel. Would you please create a tutorial on how to rotate and scale different objects after instantiating the 3D models in the AR scene? Cheers!

    • @annexgroup6878
      @annexgroup6878 2 ปีที่แล้ว

      This is exactly what I was thinking

    • @Popstudioztuts
      @Popstudioztuts ปีที่แล้ว

      @@annexgroup6878 did you find it?

  • @carmelchurchsatchiyapuram2292
    @carmelchurchsatchiyapuram2292 2 ปีที่แล้ว +1

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

  • @zidhart4286
    @zidhart4286 2 ปีที่แล้ว

    TNice tutorials is aweso! I was feeling kinda overwheld when i first start soft but after watcNice tutorialng your tutorial video, i feel much more confident

  • @jamesmethven
    @jamesmethven 2 ปีที่แล้ว +1

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

  • @benbehar7397
    @benbehar7397 ปีที่แล้ว +6

    the right scrip ( from his developer channel)
    using System;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.XR.ARFoundation;
    using UnityEngine.XR.ARSubsystems;
    [RequireComponent(typeof(ARTrackedImageManager))]
    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 _instantiatedPrefabs = new Dictionary();
    void Awake() {
    // Cache a reference to the Tracked Image Manager component
    _trackedImagesManager = GetComponent();
    }
    void OnEnable() {
    // Attach event handler when tracked images change
    _trackedImagesManager.trackedImagesChanged += OnTrackedImagesChanged;
    }
    void OnDisable() {
    // Remove event handler
    _trackedImagesManager.trackedImagesChanged -= OnTrackedImagesChanged;
    }
    // Event Handler
    private void OnTrackedImagesChanged(ARTrackedImagesChangedEventArgs eventArgs) {
    // Loop through all new tracked images that have been detected
    foreach (var trackedImage in eventArgs.added) {
    // Get the name of the reference image
    var imageName = trackedImage.referenceImage.name;
    // Now loop over the array of prefabs
    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, StringComparison.OrdinalIgnoreCase) == 0
    && !_instantiatedPrefabs.ContainsKey(imageName)) {
    // Instantiate the prefab, parenting it to the ARTrackedImage
    var newPrefab = Instantiate(curPrefab, trackedImage.transform);
    // Add the created prefab to our array
    _instantiatedPrefabs[imageName] = newPrefab;
    }
    }
    }
    // For all prefabs that have been created so far, set them active or not depending
    // on whether their corresponding image is currently being tracked
    foreach (var trackedImage in eventArgs.updated) {
    _instantiatedPrefabs[trackedImage.referenceImage.name]
    .SetActive(trackedImage.trackingState == TrackingState.Tracking);
    }
    // If the AR subsystem has given up looking for a tracked image
    foreach (var trackedImage in eventArgs.removed) {
    // Destroy its prefab
    Destroy(_instantiatedPrefabs[trackedImage.referenceImage.name]);
    // Also remove the instance from our array
    _instantiatedPrefabs.Remove(trackedImage.referenceImage.name);
    // Or, simply set the prefab instance to inactive
    //_instantiatedPrefabs[trackedImage.referenceImage.name].SetActive(false);
    }
    }
    }

  • @AbhirajGulati
    @AbhirajGulati 2 ปีที่แล้ว +6

    Hi, I've built the app on my phone but no matter what i do it doesnt seem to be placing any objects at all. As far as i can tell i've done everything as per the video but when i open the app the camera opens but it either doesnt detect or doesnt place objects(Which one i cant tell) Are there any steps i can take to debug this?

    • @ericowususarpong3063
      @ericowususarpong3063 2 ปีที่แล้ว

      I am having the same issue, any resolution??

    • @elverrepolska
      @elverrepolska ปีที่แล้ว

      I've got the same issue. I do everything step by step, but camera not detect my reference image :( Samsung S21

    • @shanonfrancis5071
      @shanonfrancis5071 3 หลายเดือนก่อน

      Sorry for necroposting. Did you get it to work? At first I thought it wasn't working but then I noticed the tip of a gray cube in the corner of the screen. Then after some moving around the image I managed to get the cube to come to the screen but it's still kinda floaty and not centered.

  • @elisabologni7481
    @elisabologni7481 ปีที่แล้ว +2

    Thank you very much for this tutorial. Unfortunately I got the following error when I build the project on Android: "The application requires last version of Google Play for AR". Everything seems ok. I also tried several devices without success. Any suggestions? Thanks

  • @saviourmbong3738
    @saviourmbong3738 2 ปีที่แล้ว

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

  • @mairem
    @mairem ปีที่แล้ว +1

    why does the unity version switch halfway through? many things are not compatible in the 2022 version and that's not mentioned

  • @Jordansj-lf8dc
    @Jordansj-lf8dc 2 ปีที่แล้ว +4

    where can i get the code??? Thanks for the the great tutorial for my first experience approaching in AR.

    • @henrikjorgensen6850
      @henrikjorgensen6850 2 ปีที่แล้ว

      gist.github.com/alastaira/92d790ed09330ea7a45e7c3a2a4d26e1#file-placetrackedimages-cs

  • @leonardusdandy.7468
    @leonardusdandy.7468 2 ปีที่แล้ว

    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

  • @jmjb67
    @jmjb67 2 ปีที่แล้ว +1

    Really great instructional video. It is up-to-date (Oct 2022), thorough, comprehensive, well-paced and concise.
    (and look, Ma: no vuforia!) :)

  • @optimus6858
    @optimus6858 ปีที่แล้ว +2

    thanks
    but my apk installs normally on android pie
    when i open it , it closes instantly

  • @lucasadami4622
    @lucasadami4622 2 ปีที่แล้ว

    screen in the top left, look at where it says program and click on where it says “aggressive te” and change it to “analog app 1 te”

  • @user-el5jg3wo9b
    @user-el5jg3wo9b 2 ปีที่แล้ว +2

    Everything built successfully but when I open the AR app it’s having a hard time recognizing the image marker, the cube object just randomly appears and disappears does anyone know how to fix this?

  • @hariswidianto2416
    @hariswidianto2416 2 ปีที่แล้ว +1

    BROTHER, YOU ARE THE BEST!!! You oooh really helped me!! THANK YOU VERY MUCH!

  • @ranchen1534
    @ranchen1534 2 ปีที่แล้ว

    This is a demo that actually works!! Great for beginners like me.

  • @phillipotey9736
    @phillipotey9736 2 ปีที่แล้ว

    Bro rockin' the Nigel thornberry look, loved the tutorial.

  • @carlosmorais6870
    @carlosmorais6870 2 ปีที่แล้ว

    I could listen to Nice tutorialm talk for hours man what a passionate dude ❤️

  • @Moki314
    @Moki314 ปีที่แล้ว +3

    I need some help. I was able to build & run the app, but when I point the camera at the reference, my object doesn't show up. The reference I'm using is an 8x8 grid of black & white squares which should be pretty easy to recognize, and is about 180 x 180mm for the entire grid, so decently large. I'm using a Samsung Galaxy S8.

  • @sivamurugan9132
    @sivamurugan9132 2 ปีที่แล้ว +3

    Hi can any one assist me. When I done with coding I am receiving error in Script component in Unity as " Associate Script cannot be loaded. Please fix any compile errors and assign a value to script". But there is not error showing in Visual studio

    • @jjaylee6095
      @jjaylee6095 2 ปีที่แล้ว

      I have the same problem, did you solve it

  • @davefrancis4970
    @davefrancis4970 5 หลายเดือนก่อน +1

    That's a fantastic explanation and thanks very much !

  • @allenwazny4355
    @allenwazny4355 2 ปีที่แล้ว

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

  • @Upper_Room_Studios
    @Upper_Room_Studios ปีที่แล้ว

    Hey! It's the dad from The Wild Thornberrys!

  • @youniverseapparel539
    @youniverseapparel539 2 ปีที่แล้ว

    I'm not sure about tNice tutorials, but if you wanna fix it open GMS. Then in the GMS, there's a light blue screen with a lot of buttons and other stuff.

  • @АнтонийСердюков
    @АнтонийСердюков 9 หลายเดือนก่อน +1

    My model appears and disappears but it looks to be connected to the phone not the image. Tried to update the packages, changing the API level. Any suggestions?

  • @indriyanipuspita3575
    @indriyanipuspita3575 2 ปีที่แล้ว

    BROOO THANK YOU!!!!!!!!!!!!!!!!! YOU'R THE BEST!!!!!! I LEARNED EVERYTNice tutorialNG I NEEDED TO KNOW THAN YOU VERY

  • @joaoprata4065
    @joaoprata4065 9 หลายเดือนก่อน

    Finally what i've been serching for so long. Subscribed! Is there a way to publish your AR experiences so that you can share on social media?

  • @BettyMoore-g5e
    @BettyMoore-g5e 4 วันที่ผ่านมา

    You are doing a great job! Can you help me with something unrelated? I have a SafePal wallet with USDT in it and I have my recovery phrase.-----------. How do I transfer them to Binance?

  • @all-realities
    @all-realities ปีที่แล้ว

    Thank you Alastair, that was immensely helpful to get a start with an AR app!

  • @pix3ls53
    @pix3ls53 2 ปีที่แล้ว +4

    Does anyone else have a problem where when deploying the program in a device, the object keeps flickering in and out when scanning?

    • @user-el5jg3wo9b
      @user-el5jg3wo9b 2 ปีที่แล้ว

      I have the same issue!! Have you find the solution to that?

    • @abcdefg-hq6my
      @abcdefg-hq6my ปีที่แล้ว

      @@user-el5jg3wo9b I saw someone else with same issue in comments and again I know it's a bit late but I've had this issue and managed to resolve it by simply changing 0 to 1 in the AR Tracked Image Manager component that is attached to the AR Session Origin.

  • @inboxdesignstudio6354
    @inboxdesignstudio6354 2 ปีที่แล้ว

    Tgank you so much for Uploading this, was waiting from so many days for your upload. Thanks

  • @AhmadFaraz-bb9tp
    @AhmadFaraz-bb9tp ปีที่แล้ว

    As you have said ar session origin will be changed to xr origin they did exactly the same in the lattest version of 2022 LTS.

  • @bambinoesu
    @bambinoesu 2 ปีที่แล้ว +2

    sorry when i copy and paste the cs script. it keeps saying "associated script can not be loaded, please fix any compile errors and assign a valid script".
    help please.
    update:
    fixed issue. the script name has to be spelt the exact same on the cs code

    • @danielegiomigraphicdesigner
      @danielegiomigraphicdesigner 2 ปีที่แล้ว +1

      thank you so much man! I was freaking out 😵

    • @bambinoesu
      @bambinoesu 2 ปีที่แล้ว

      @@danielegiomigraphicdesigner you're welcome, so was I 😅

  • @bennguyen1313
    @bennguyen1313 4 หลายเดือนก่อน

    Any changes to the AR Tool landscape since this video was made? For example, Flutter , ARLoopa, or Flet/ARCore ?
    I'd like to make an Android application that can find components from a circuit board! Just use your camera and it will overlay a marker on the component... however, not sure if there is a minimum marker size , and if it can be overlayed with such high precision.
    For example, if you have a sheet of paper with a grid of squares, say 50x50.. if A4 is said/entered, could AR use a fiducial on the paper to calculate how far into the grid it needs to place a marker (scaling it based on the the angle and how close the camera is to the sheet).

  • @dineipinheiro4990
    @dineipinheiro4990 2 ปีที่แล้ว

    TNice tutorials is just the pick up I needed, thanks man

  • @zachheaven
    @zachheaven 2 ปีที่แล้ว +3

    THIS IS TOTALLY AMAZING. Ive always wanted to start studying AR and this was the perfect jumping off point. One question i had was where could we find the script put into visual studio at the 16 min mark?

    • @zachheaven
      @zachheaven 2 ปีที่แล้ว

      found it. theres a link to the description at the end which leads you to github. scroll down on that and youll find it

    • @pedrodavid2599
      @pedrodavid2599 2 ปีที่แล้ว

      @@zachheaven do u still got it? I couldn't find it

    • @theharmont7390
      @theharmont7390 2 ปีที่แล้ว

      @@pedrodavid2599youtube does not allow you to send links :(

    • @kinga.b.1709
      @kinga.b.1709 2 ปีที่แล้ว

      ​@@theharmont7390 , Hello! Could you add this link to the description of your latest video on your channel?

    • @hellhxxoundss1930
      @hellhxxoundss1930 ปีที่แล้ว

      im making this for a project .. can u please send the link via any social media site .. i reall need that line of code .. thanks@@theharmont7390

  • @rekiallard77
    @rekiallard77 5 หลายเดือนก่อน

    Hi Sir, I am very new to SDK and AR. I am confused about determining the SDK, which device is suitable for it. I always encounter errors when I want to build an application. I hope you make a tutorial about SDK and Unity 2017 because this version is the best in my opinion and the beginning of AR being implemented in unity.

  • @rubangga4694
    @rubangga4694 2 ปีที่แล้ว

    I really enjoy your channel and you are a good teacher. I might have missed sotNice tutorialng and I don't get friends with the setuper. I worked

  • @gert2373
    @gert2373 2 ปีที่แล้ว

    Hi
    Do you ever go back and check if there are any questions on your older projects you posted?

  • @tadeoac4416
    @tadeoac4416 6 หลายเดือนก่อน +2

    I got a popup with this message, "Tap to place Touch surfaces to place objects"
    Someone knows how to remove it?

    • @AndrejSatnik
      @AndrejSatnik หลายเดือนก่อน +1

      Maybe too late but I still leave here a comment in case someone would wondering. In your scene you have another objects that comes with newer version of Unity, such as UI or some Inputs/Events. You should have only AR Session, AR/XR Origin and a light in your scene.

  • @andreasilvestri4745
    @andreasilvestri4745 2 ปีที่แล้ว +2

    Hi, thank you to share this amazing video. I have the black screen when i run the app on my smartphone (Galaxy S8 - Android V.9). I do not why the camera not working. Unity Editor version used: 2021.3.7f1

    • @yi8634
      @yi8634 2 ปีที่แล้ว

      I have the same problem! Don't know how to resolve it.

    • @lucasfellipemondinipereira1099
      @lucasfellipemondinipereira1099 2 ปีที่แล้ว

      @@yi8634 you have forgot to anable the arcore

    • @qisthial882
      @qisthial882 2 ปีที่แล้ว

      @@lucasfellipemondinipereira1099 hi I already did that but it still doesn't work for me. any other suggestion?

    • @nuelaenebechi6861
      @nuelaenebechi6861 2 ปีที่แล้ว +1

      @@qisthial882 please did you solve this? I am having the same problem

  • @paulmiddleton705
    @paulmiddleton705 ปีที่แล้ว +1

    I had an issue with the Android phone not putting the 3D image over the anchor. Not sure what helped exactly. But potentially it might have been due to the size of the cube being too large to fit within the screen area. It was 1m3 and worked after I adjusted to be 0.1m3. Hope that helps someone else

  • @abdoudzabdoudz420
    @abdoudzabdoudz420 2 ปีที่แล้ว

    man I missed this kind of tutorials lol. Great work here, thanks!!!

  • @mwvitorino
    @mwvitorino ปีที่แล้ว

    Hello, sorry for the translation via Google. When you are explaining about the event handler, is there a foreach that goes through the trackedImage variable where it is fed? Sorry for the stupid question, I program in PHP/Jquery some things are very familiar others I'm a little confused.

  • @get_seb
    @get_seb 2 ปีที่แล้ว +1

    I wanna ask for the tracking of the images, is there any limitation where by the colour must match? lets say the image library we gave a colour image but we track a monochrome image. Does it work?

  • @AhmedMohamed-me1gi
    @AhmedMohamed-me1gi 2 ปีที่แล้ว

    But right below in the corner of tNice tutorials blue screen, there's "Program" wNice tutorialch most likely states "Aggressive TE" if you click on that you have a

  • @stuffwithjuice2111
    @stuffwithjuice2111 2 ปีที่แล้ว

    I've seen that has actually explained it to in a concise way!

  • @1larrydom1
    @1larrydom1 2 ปีที่แล้ว

    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!

  • @JPENG3
    @JPENG3 2 ปีที่แล้ว

    I am very glad that I stumbled upon your video

  • @pedrodavid2599
    @pedrodavid2599 2 ปีที่แล้ว +2

    Hi, everyone. I have an issue. I made the app and it runs perfectly, the camera it's starting normally on the app at my mobile device, but when I point it to the anchor image, nothing happends, the cube does not appear above it. Does anyone knows how I fix that, pls?

    • @henrikjorgensen6850
      @henrikjorgensen6850 2 ปีที่แล้ว

      Hello Pedro
      I have the same problem, I just opdt. to the new version (2022.1.20f1) Have you solved your problem?

  • @HumbleHustle101
    @HumbleHustle101 3 หลายเดือนก่อน

    Hi, Nice video, Can you demonstrate a case where the augmented reality game uses objectron object detection to sense the direction of the object with respect to the movement of the object. A usecase can be there is a car toy and based on the objectron users can see certain effects like turbo and smoke based on the object velocity at the correct position i.e. at the rear always.

  • @manojdaniels
    @manojdaniels ปีที่แล้ว

    Awesome Description Brother. May God Bless you !!

  • @pablosalas9094
    @pablosalas9094 ปีที่แล้ว

    hi I loved this video is very clear, what I don't know is how do you do to put another card over the original one?

  • @Kenji_195
    @Kenji_195 2 ปีที่แล้ว

    I loved that code, smart, fancy and easy to read/understand

  • @DaftFrik
    @DaftFrik 2 ปีที่แล้ว +5

    Hey, I followed the tutorial closely, but when I run the app on my phone, I only see a black screen. Searching around, the common advice for this is enabling ARCore in XR Plug-in Management but I have already done that. Any suggestions for what the problem may be?

    • @pil_low
      @pil_low 2 ปีที่แล้ว

      Deleted the main camera?

    • @dkm3025
      @dkm3025 2 ปีที่แล้ว +1

      did you add the scene in the build settings?

    • @andreasilvestri4745
      @andreasilvestri4745 2 ปีที่แล้ว

      Did you solve the problem? I have the same issue. 😫

    • @DaftFrik
      @DaftFrik 2 ปีที่แล้ว

      @@andreasilvestri4745 I had to use a proper build, it didn't work with unity remote

    • @andreasilvestri4745
      @andreasilvestri4745 2 ปีที่แล้ว

      @@DaftFrik i built the apk and installed on my smartphone. What you mean with proper build? Thank you very much.

  • @jayaxell
    @jayaxell ปีที่แล้ว +1

    im having an issue where the object that im placing keeps floating everywhere... anyone knows why?

  • @x2blader
    @x2blader ปีที่แล้ว +1

    I got the app to build, but it doesn't seem to recognise the images...the video it's supposed to play won't play. Please help

  • @TripwithCharlien666
    @TripwithCharlien666 ปีที่แล้ว

    Hello, great tut!! now, how can we test/run our oriject thru the cellphone, mine says something regarding USB cable and Unity instructions u.u

  • @LearnProfessional1
    @LearnProfessional1 2 ปีที่แล้ว

    all the different elents together in a language that is universal. I've seen plenty of DAW tutorials being new, but tNice tutorials is by far the best so

  • @MM-ye7og
    @MM-ye7og 2 ปีที่แล้ว

    Nice tutorial brother i just want to ask you wNice tutorialch software is easy and best to learn as DAW soft soft or abelton live. Pls reply as soon as you can

  • @deedd4401
    @deedd4401 5 หลายเดือนก่อน

    given how fast everything changes.... i would like to ask , is the most of the information still relevant ? I'm sure the process might have stayed somewhat same, but unity could have changed, plugins, detection algoriddims .. etc etc .... so not questioning the validity of the advice provided , just wondering on how rather applicable it is - given the tools are up to date.

  • @djharry7372
    @djharry7372 2 ปีที่แล้ว

    Look up how to make templates, once you have a template customized for you, you can get to making soft quickly

  • @beecee793
    @beecee793 ปีที่แล้ว

    Any examples for meshing the environment? And using that instead of detecting simple planes or tracking a specific image?

  • @womisuVv
    @womisuVv หลายเดือนก่อน

    For the image that you had of that cartoon character where the character was on top of the piece of paper is there a way that you could rotate that character so that way he is not standing on top of the paper, but instead standing in front of the paper, as if you were holding the paper vertically and he was floating in front of the paper?

  • @motionlifestudio9572
    @motionlifestudio9572 ปีที่แล้ว

    Hello, I would like to know how can I add interactivity like rotate, scale and select objects in AR foundation in image tracking mode.

  • @engcisco
    @engcisco 2 ปีที่แล้ว +1

    Many thanks for the great video, is it possible to export it for web using WebGL? is it supported?

  • @taniasalla
    @taniasalla 2 ปีที่แล้ว

    You saved my life, THANK YOU!!!

  • @Roadrunner_KZSK
    @Roadrunner_KZSK ปีที่แล้ว

    Works well until I get like half a meter (1.6ft) away from the image with my camera, in other words, the image has to take up at least like 20% of my camera video feed to work correctly. As soon as I "zoom out" the tracking is lost. Tested it with different markers and different light setups but that doesn't seem to be the issue.
    Is there a way to fix this? Perhaps a fundamental setting I'm missing? I've set the tracked images physicla size in my ReferenceImageLibrary asset but that did seemingly nothing.

  • @NoCodeFilmmaker
    @NoCodeFilmmaker 2 ปีที่แล้ว

    Whoever gave that dislike should get punched in the mouth. Great job on making a fantastic and easily comprehensible tutorial. I'm trying to add an interactive story element to my posters via AR and this was just what I needed. Thanks a million times over.

  • @AhimsaCreative
    @AhimsaCreative 2 ปีที่แล้ว +1

    so how does one find the script? I even joined the patreon nut it was impossible to find - seems very strange that there are no direct links

  • @kotraner
    @kotraner ปีที่แล้ว

    1:38 is it real that using image tracking in ar foundation support? because I made image tracking sample code, but it dosen't seem as good as you show in 1:38

  • @decayingsofacinema-relaxin6072
    @decayingsofacinema-relaxin6072 ปีที่แล้ว

    dear boss, when I follow your guide, when in "install" step, I install the "Unity 2022.3.2f1", but there are only 3 topic under that: they are "editor application""documentation""webgl build support"... there is no "android" or "ios build" option... strange...

  • @apencilneckdesigns
    @apencilneckdesigns 2 ปีที่แล้ว

    Hey, thank you so much for this tutorial. I am using a Samsung a32 5g for this. When I hit 'build and run', I get an error. Any thoughts of what the issue might be? Thanks for you help!

  • @sarahwasifaferdousi1689
    @sarahwasifaferdousi1689 ปีที่แล้ว

    Hii, thank you sm for the tutorial. I've followed it to a t but i only get an array of faint white dots? How do i fix it?

  • @kimnana6652
    @kimnana6652 2 ปีที่แล้ว

    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

  • @r.r.divanarindranidaniella3543
    @r.r.divanarindranidaniella3543 2 ปีที่แล้ว

    Between Producer and Signature, wNice tutorialch SKU would you recomnd? Is Signature worth the 50% price bump? ItNice tutorialnk I want to have

  • @lulupont
    @lulupont 10 หลายเดือนก่อน

    this is amazing, great tutorial. but what if I dont want to depend on a single device? what if I want to make it web based? working for android and IOS?

  •  2 ปีที่แล้ว

    Every Producer, DJ, soft Maker and writer will love tNice tutorials feature. Please encourage soft-soft to make tNice tutorials happen. Fingers

  • @jacqui6954
    @jacqui6954 2 ปีที่แล้ว

    I love your channel❤. Please continue making videos. I have a very good feeling that you will succeed