O'Reilly logo

Learn ARCore - Fundamentals of Google ARCore by Micheal Lanham

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Building the object outliner

We will build an ObjectOutliner class to handle the outlining for us. Follow along as we build the pieces to turn the outline on and off as the user selects an object:

  1. Create a new C# script called ObjectOutliner in the Assets/ARCoreDesign/Scripts folder.
  2. Replace all of the pregenerated script with the following:
namespace Packt.ARCoreDesign{    using System.Collections;    using System.Collections.Generic;    using UnityEngine;           public class ObjectOutliner : MonoBehaviour    {        public int MaterialSlot;        public Material DefaultMaterial;        public Material OutlineMaterial;        public bool outlineOn;         public void Outline()        {            outlineOn = !outlineOn;            var renderer = GetComponent<MeshRenderer>(); Material[] mats = renderer.materials; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required