I have a Scriptable Object class called Ability, which inherients Scriptable Objects:
public class Ability : ScriptableObject {
public new string name;
public string aDesc;
public int aCoolDown;
public Sprite aSprite;
}
And a child of Ability called BasicOffensiveAbility, which inherits Ability:
public class BasicOffenseAbility : Ability {
public Sprite pSprite;
public float pSpeed;
public bool allEnemiesAffected = false;
}
Since there could be multiple children of Ability, I check the type, and I want to access a variable within BasicOffenseAbility, i.e. pSpeed:
public void UseAbility(Ability a){
if(a is BasicOffenseAbility) {
LaunchProjectile(a.pSpeed);
}
}
But I cannot seem to access the variable of pSpeed, but only the base variables of Ability ( name, aDesc, aCoolDown, etc.).
So, is there some way to access the variables of an inherited Scriptable Object?
Where is the "UseAbility" method located? Since I cannot see the class, I would make a guess to assume that the method is in a class does not inherit from "BasicOffenseAbility" although I cant say for certain. Perhaps add the class definition where "UseAbility" resides?
– Gyniatrics