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

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.