Hello,
I’am testing VR (3D) and new to unity.
I want to get color from image (like color picker).
Function GetPixel working well for me, but in another direction or rotation returns bad COLOR.
Only when camera is forward to image, solution works well.
Why? Can you help me please?
Thank you.
My code is
Color color = image.sprite.texture.GetPixel(
(int)((pickerObj.transform.position.x - transform.position.x) * (1 / GetComponent<RectTransform>().localScale.x) * (1 / GetComponentInParent<Canvas>().scaleFactor)),
(int)((pickerObj.transform.position.y - transform.position.y) * (1 / GetComponent<RectTransform>().localScale.y) * (1 / GetComponentInParent<Canvas>().scaleFactor)) + GetComponent<Image>().sprite.texture.height)
);