Underwater effects error?

I run my game, with a character controller and everything, and it says to fix all the errors in the compiler. I look in the compiler and I see this:

'Assets/Scripts/UnderwaterEffects.js(23,46): BCE0022: Cannot convert ‘UnityEngine.GameObject’ to ‘float’.

What is this and how can I fix it? and there is no water in my scene…

Windows 7 64-bit

waterLevel is float and gameObject is an object.

This has been discussed in Unity Forum and seems it happened for project conversion.

So the following will fix it.
if(water) waterLevel = water.gameObject.transform.position.y;

The beginning of Awake() is wrong. I don’t know how it was before, but with some changes it may work - or at least stop producing compiler errors (any script with errors prevents the whole project from work, even if you don’t ever use it).

I believe the modifications below are enough: add a water GameObject variable and modify the first if in the Awake function:

...
private var blur : BlurEffect;
var water: Water; // declare this variable

function Awake() { // and modify the first "if" of Awake to this:
  if (!water) { // if water not set at the Inspector...
    water = FindObjectOfType(Water); // try to find Water object
    // if found, set waterLevel to the water position
    if (water) waterLevel = water.gameObject.transform.position; 
  } 
  ...

switching the case on the G cleared the error for me. Not sure how to test if the script is still working. The next error was something about not supporting UnityEditor, so I just commented those two lines out in the file UpdateTreeColors

Hi,

You can use the following code instead of code line 23.// if(water) waterLevel = water.gameObject;

if (water) waterLevel = water.transform.position.y;

Thanks
Ram

just switch the lower case g on gameObject to a capital so its GameObject