Hi I see this error comes up a lot, especially when Unity updated to 5.6

Is there a way to get around this syntax error?

float4x4 vp = UnityObjectToClipPos(unity_WorldToObject);

Hi I see this error comes up a lot, especially when Unity updated to 5.6

Is there a way to get around this syntax error?

float4x4 vp = UnityObjectToClipPos(unity_WorldToObject);

The “UnityObjectToClipPos” method always expected a vector as parameter and not a matrix. It’s defined like this:

```
// Tranforms position from object to homogenous space
inline float4 UnityObjectToClipPos(in float3 pos)
{
#if defined(STEREO_CUBEMAP_RENDER_ON)
return UnityObjectToClipPosODS(pos);
#else
// More efficient than computing M*VP matrix product
return mul(UNITY_MATRIX_VP, mul(unity_ObjectToWorld, float4(pos, 1.0)));
#endif
}
```

Taken from `Unity\Editor\Data\CGIncludes\UnityShaderUtilities.cginc`

. However since it seems you want to create a matrix that takes a **world space coordinate** into **clipspace** you just have to use the “UNITY_MATRIX_VP” matrix which does exactly this. It expects a world point and transforms it into view space using the camera matrix (V) and finally transforms the point into clipspace by using the projection matrix (P)