• Home  / 
  • Unity3D
  •  /  Unity3D Interfaces vs Abstract Classes

Unity3D Interfaces vs Abstract Classes

If you’re not using Interfaces and Abstract classes in your Unity projects, you’re missing out. These 2 concepts are extremely helpful for c# development, and using them properly can make your game code simple and extensible. In this article, I’ll point out the differences between the two, benefits and drawbacks, and when to use each of them.

Differences

Interface

Abstract Class

GetComponent<T>

Yes

Yes

FindObjectOfType<T>

No

Yes

Define a Contract

Yes

Yes

Default Implementation

No

Yes

Multiple on a Class

Yes

No

Vary Base Class

Yes

No

Video 1 – Interfaces

 

Video 2 – Abstract Classes