compiler error.

when i try to enter play mode in unity, it gives me an error saying that i need to fix the compiler error. so I go into console and this is the error: Assets/Scripts/UnderwaterEffects.js(23,46): BCE0022: Cannot convert ‘UnityEngine.GameObject’ to ‘float’. How do i fix this error in the script? help would be greatly appreciated, please take in mind that i am new to unity. Thanks for the support.

It’s a known problem with the old Island Demo script (one of them - there are lots of other bugs!) - it was written for Unity 2.x, and doesn’t work in Unity 3.x.

This error occurs because line 23 tries to assign water.gameObject to the float waterLevel (no idea on how this could have ever worked in any Unity!):

  if(water) waterLevel = water.gameObject;

You can fix this error by simply changing line 23 to this:

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

But this doesn’t solves all the problems: the script UpdateTreeColors.js will give two errors, in lines 13 and 31; just place a comment signal (//) in front of each of these lines to comment them out, and the Island Demo should compile and work (at least in Unity Free; maybe other errors arise in the Pro version.)

You probably tries to assign Object type to primitive type, i.e. GameObject to some float variable. This is not possible. Probably misspelled or copypasted.

You should be using a variable that is of a “GameObject” type as a float. For example:

function OnCollisionStay(collisionInfo : Collision) 
{
	var platformerController : PlatformerController = collisionInfo.gameObject; //Getting a gameObject
	var x : float = 10.0 + platformerController; //and using it in a arithmetic operation
}