Yesterday I've found out about Scriptable Objects in Unity.The first thing that came to my mind is : hey , this is really simillar to inheritance.Let's say I have this:
[CreateAssetMenu(menuName = "Scriptableobjects/enemy_data")]
public class enemydata : ScriptableObject
{
public float HP;
public float mana;
public float damage;
}
If I have three enemies A , B , C i will just create 3 instances of enemy_data in my project assets , and complete HP , mana,damage individually.On each of my enemy monobehaviour i'll say :
public enemydata data;
And I'll drag the instances from project assets in their inspector.This is what I understood about scriptable objects from the tutorials I have seen.But , what if i did this:
public class enemydata
{
public float HP;
public float mana;
public float damage;
}
And just inherit this class?Wouldn't this be the same thing?
public class enemy1:MonoBehaviour , enemydata
{
void print()
{
Debug.Log(this.HP + " " this.mana + " " + this.damage);
}
I know I am missing something so please correct me.Thanks!