# Do i lose performance doing this

 public class TileObject : MonoBehaviour {

////some code was here
public PlayerAnimator playerAnimator;

////some code was here

public void SetTileObject(int xPos, int yPos, TileData tileData)
{
////some code was here

if (tileData.player)
playerAnimator = new PlayerAnimator();
}


And my question do i lose any performances(or memory) doing this instead of inheritance or something else.(tileObject can be other than player)

• Don't assume something is causing you performance issues until you see actual problems, then use a profiler to see what's wrong. – Almo Jul 12 '18 at 14:26