How does it work?
6_ScriptableEnums
ScriptableEnums are simply ScriptableObjects used as enums. To compare them, we just compare their references. If you open the Element.cs component located on an Element object, you can see the code.
In our case, when an element collides with another, we check if the other element type is contained in our Defeats list. If it is, then we can destroy it. This approach is flexible because you can add or remove element types from this list at runtime or through code. Additionally, if you want to create a new element, all you need to do is duplicate an existing SE and rename it. That’s it—no code involved.
Last updated