How to fix pink water in Unity

Forest Shore

The water prefab in Unity’s standard assets has bugs by default. If you search FX-Water in your Project window and click on the FX-Water script, you will likely find Unity complaining about compile errors in the inspector; undeclared identifier ‘unity_ObjectToWorld’. The problem is that unity_ObjectToWorld variable is used without being declared. Here is how to fix it.

Double-click the FX-Water.shader script to open it in the editor. Find where unity_ObjectToWorld is being used, which is likely on line 80. Replace ‘unity_ObjectToWorld’ with ‘_Object2World’. Note the removal of ‘unity’, and the replacement of ‘To’ with ‘2’.

float4 wpos = mul (unity_ObjectToWorld, v.vertex);

should become

float4 wpos = mul (_Object2World, v.vertex);

That’s it. Save your script, and Water Pro and Water Basic are fixed.