public void Apply(GameObject o, Color[] sample, Vector2 sampleSize) { var s = o.GetComponent<SpriteRenderer>().sprite; var world2texture = new Vector3(s.texture.width / ScaleWorld.x, s.texture.height / ScaleWorld.y, 1); Vector3 size = gameObject.getSpriteSize(), from = (o.getSpriteBottomLeft() - gameObject.getSpriteBottomLeft()), to = from + o.getSpriteSize(); helperApplyTextureAt(sample,sampleSize, from.divide(size).XY(), to.divide(size).XY()); }