All of the pieces of code which compose the AI behavior are stored in ScriptableObject assets, which you can then configure and combine in the Inspector, without writing additional code. An example of this is seen in the video series below showing the Pluggable AI System. These values also persist after being changed in play mode, since we are changing a value on an asset.Īnother way that we can use them is to create assets which hold executable code. This can help with both the centralization of data and version control. You could simply edit a single value on our ScriptableObject asset, as opposed to having those values stored in the public fields of a MonoBehaviour attached to an enemy prefab or prefabs. Say you want to change the maximum speed of all those enemies. One example would be to create a custom asset that holds all the statistics for a given enemy type. So what are they? To quote the manual “A class you can derive from if you want to create objects that don't need to be attached to game objects.” This is a good start, I’d add to this that they allow you to create objects which are assets which can either hold custom data or execute code. They offer an interesting set of tools to extend your programming toolkit in Unity and helped me to think about certain architectural problems I’d been having in my projects a little differently. When I did learn about them, however, I got ScriptableObject fever. I would not call them something that beginners urgently need to know when getting started. I had been programming in Unity for a decent amount of time before I learned about ScriptableObjects. I've produced some online video training using ScriptableObjects and thought it would be cool to put them together in a blog post, along with a few related Unite talks by people much smarter than me, and so here we are! I make stuff in Unity and teach others how to do it via our Twitch channel and on YouTube. I'm Matt Schell, the Senior Screencaster on the Online Evangelism team at Unity.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |