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; ...

Get Learn ARCore - Fundamentals of Google ARCore now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.