Simple Question: Animations and Base Class

Hello. Just a simple question:
Is it possible to work with animations inside of abstract class?

Lets say I have:

public abstract class Enemy {

    private AnimationClip _attackAnimation;

    public virtual void Attack() {

        // and now I want do do something like this:

Thanks for any help.


You need to subclass your Enemy class to actually do anything with it, but this is exactly how you implement abstract classes.

Though, for that to work, your Enemy class has to inherit from MonoBehaviour, otherwise GetComponent doesn’t exist.