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

Activating the warning

Let's delay our discussion of training a bit further and put together a simple example to see how this works. Open up Unity again and perform the following steps:

  1. Create a new C# script called EnvironmentScanner in the Assets/ARCoreML/Scripts folder. Then, open the script in your editor.
  2. Add the code, as shown, to the class definition:
[RequireComponent(typeof(AudioSource))]public class EnvironmentalScanner : MonoBehaviour  //before me
  1. RequireComponent is a custom Unity attribute that forces a GameObject to require a specific class before this component can be added. In this example, we require an AudioSource component.
  2. Enter the following new properties/fields and method to the class; don't delete anything:
public ...

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