Why visualElement.WorldToLocal(mousePosition) returns zero when visualElement is scaled by transform?
Hi There. I build an editor window with UIToolkit and it has zoom effect like what shader graph has. In previous versions on Unity, I mean 2021.1 and earlier I used MouseDownEvent.localMousePosition
and it worked perfect in scaling but now I updated my project to 2021.2.7 and I think there is problem here. now MouseDownEvent.localMousePosition
return zero when there is even a slight scaling and also visualElement.WorldToLocal(MouseDownEvent.mousePosition)
have the same effect. Even I tested transform.matrix.inverse * MouseDownEvent.mousePosition
and still it returns zero.
Can anyone please tell me what I'm doing wrong here? Thanks
Answer by mossibat · Feb 05 at 08:41 AM
After some tests I found out I set transform.scale.z to zero and this cause the issue here.
Your answer
