public void ChangeColor(BrickManager target) { var targetSpriteRenderer = target.GetComponent <SpriteRenderer>(); if (targetSpriteRenderer == null) { return; } var color = colors.Find(c => c.type == target.type); if (color != null && color.sprite != null) { targetSpriteRenderer.sprite = color.sprite; targetSpriteRenderer.color = Color.white; } }