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:
- Create a new C# script called EnvironmentScanner in the Assets/ARCoreML/Scripts folder. Then, open the script in your editor.
- Add the code, as shown, to the class definition:
[RequireComponent(typeof(AudioSource))]public class EnvironmentalScanner : MonoBehaviour //before me
- 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.
- Enter the following new properties/fields and method to the class; don't delete anything:
public ...