I can’t seem to figure out how to get local positions within a UI shader. No matter what I do, unity_WorldToObject always transforms points without respecting the transformation of my RectTransform.
It’s almost as if unity_WorldToObject is an identity matrix in the shader.
Is this by design? How can I transform the incoming vertex into local RectTransform space in the shader?
Currently needing to pass the RectTransform localToWorld matrix as a Shader property. But I feel like this is wrong. unity_ObjectToWorld should be correct right?
UI meshes, along with any dynamically or staticly batched meshes, are generated in world space. Thus the unity_WorldToObject really is just an identity matrix. Passing it in as a parameter is the only way to get the matrix you want.