So a simple example i have:
public interface IFollow{ Transform Target {get;} void LateUpdate(); } public SomeClassA : Monobehaviour , IFollow { public Transform Target {get; set;} public void LateUpdate(){ //follow the target logic } } public B : Monobehaviour , IFollow { public Transform Target {get; set;} public void LateUpdate(){ //follow the target [duplicate code as seen in A] } When you have lots of different objects that follow a target with the same logic the implemented interface forces you to write a lot of duplicate code.
It also doesn't make much sense to do it via a base class since not all objects will follow.
What's a cleaner way to do this without so much duplication ?
Encase any one wondered, Monobehaviour is a Unity3D thing, though not overly relevant to the question but thought i'd mention it.