I am trying to figure out how to handle a class that has some fields and a method. I don’t want all the stuff that comes with MonoBehavior. This class will only ever be stored on an object and that object will call the single method on this class that has an overridden definition from an abstract class.
I have numerous classes that inherit from the same abstract class to have the behavior of an interface but while also passing on all the fields and members that will be in every single class. The one unique implementation detail is the logic within the method.
I am looking at storing this as scriptable object? But I am reading that it’s only for data no methods? It also says in the docs that you have to store it as an ASSET in the editor. But when I look up what the heck an asset is I get nothing. It seems to be some magical thing that isn’t explained. All I get is Asset Store information.
What is an Asset in Unity? Is there some docs or something that explain this in depth? Can scriptable object have methods? And would this be the ideal solution?
Example:
public abstract class Ability
{
fields;
properties => fields;
AbstractMethodForUniqueDefinitionPerClass(Param param1);
}
public class AbilityOne : Ability
{
Over Method()
{
Definition;
}
}
Each of these abilities? Would I store these as assets? Or scriptable object? From the documentation I don’t get a clear sense of what to do or even what scriptable object is other than basically a visual template for a struct (although structs can have methods now).
I found this for Asset:
But it doesn’t explain anything regarding an Asset or what it is or what you should use it for. I don’t even think it’s actually refering to an Asset but regarding version control info on an “Asset” that magical thing that doesn’t seem to be defined anywhere? (That I have looked)
My end goal is to be able to assign these abilities in the editor. But hopefully without monobehavior because I don’t need transform as it’s just data and a method, no location or any of that.