How it works...

The ScriptableObject abstract class helps us define what the file stores, and the CreateAssetMenu directive helps us create a new asset that could be included later in any of our scripts easily, as shown in the following screenshot:

That way, we can change the configuration values as we wish, without depending on a game object, scene, or prefab, and reuse them at will; for example, having the same configuration for a couple of dummy drivers with no specific profile in our racing game, as shown in the following screenshot:

Get Unity 2018 Artificial Intelligence Cookbook - Second Edition 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.