We have two basic classes, one specifies a base item and the other specifies a health pot (which inherits from Item). They also offer a powerful abstraction, which is often exactly what you want in complicated systems.Ĭonsider the following class structure: Item In the right situation, this means that they can be much more versatile and efficient than their counterparts. If you know what MonoBehaviour is, I’m sure ScriptableObject will be no stretch.Ĭlasses that inherit from ScriptableObject are essentially MonoBehaviour classes with the exception that they don’t need to be attached to game objects. Consequently, they seem to have a kind of air around them that suggests they’re complicated and difficult to understand, when the opposite is true. These things are severely underrepresented in the Unity documentation and examples. Why Scriptable Objects?ĭon’t be alarmed if you haven’t even heard of scriptable objects in Unity until now. So my goal here is to try and collate the information and experience I gathered when writing our inventory system. The majority of material I found online 1 2 3 4… really doesn’t explain much more than some tips on getting started, or misses these marks. Something that might surprise you is that there is actually a lack of content on making easy to use inventory systems in Unity.Īnd I think that these points are quite significant, particularly the first, because it ties everything else together. Making a Painless Inventory System with Scriptable Objects in Unity
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |