Abstract Classes vs. Interfaces

2D Mobile Game

Abstract Class

An abstract class is a class that is declared abstract and has an option to define abstract methods. They cannot be instantiated but can be subclassed and the subclass can access all the implementation that is public or protected. They can define data.

Interface

Interfaces are a set of methods, properties, and other members that a target class must implement. They are not allowed to define data.

Differences

Abstract class can define data

Interface cannot define data

Subclass can only inherit one abstract class while multiple interfaces can be inherited

The methods, properties, and other members in abstract class doesn’t need to be used by the subclass while it in mandatory in terms of Interface.

In Summary, You use abstract class when same set of methods and properties are used by multiple gameobjects of similar type while you use Interface to define set of methods and properties that you want all the inherited classes to implement.

Unity Developer