Island Demo Trees

I'm new to Unity. I was experimenting with the Island demo. In the compiled game/Game tab all the trees glow. The glows go through everything but only appear at a certain range. I have a compiler error that says: Shader warning in 'Hidden/Grayscale Effect': Upgrade NOTE: SubShader commented out because of manual shader assembly at line 10

This is a known issue with the Island Demo and Unity 3. Not sure if this didn't get fixed for release but seemingly not. Look for the file Scripts/UnderwaterEffects.js

And make sure to disable the glow on startup (e.g. in Awake() or Start()) by saying

glow.enabled = false;

Here's the full modified Awake() method:

function Awake() {
    if(!waterLevel)
    {
        water = FindObjectOfType(Water);
        if(water) waterLevel = water.gameObject;
    }
    aColor = RenderSettings.fogColor;
    aDensity = RenderSettings.fogDensity;

    glow = GetComponent(GlowEffect);
    blur = GetComponent(BlurEffect);
    if( !glow || !blur )
    {
        Debug.LogError("no right Glow/Blur assigned to camera!");
        enabled = false;
    }
    if( !waterSurface || !underwaterSurface )
    {
        Debug.LogError("assign water & underwater surfaces");
        enabled = false;
    }
    if( underwaterSurface != null )
        underwaterSurface.enabled = false; // initially underwater is disabled

    if (glow)
        glow.enabled = false;
}

Also, you need to manually switch off the GlowEffect which is attached to First Person Controller Prefab/Main Camera (in the Hierarchy).

Finally, there's still a problem when you leave the water: The glow isn't switched off correctly. Not sure why this worked in 2.6 and doesn't in 3.0 ... but to fix it, replace glow.enabled = !below with glow.enabled = below twice in Upate(). So it looks like this:

function Update ()
{
    if (waterLevel < transform.position.y && below)
    {
 Debug.Log("Leaving water");
        audio.clip = aAudio;
        audio.Play();
        RenderSettings.fogDensity = aDensity;
        RenderSettings.fogColor = aColor;

        below = false;

        glow.enabled = below;
        blur.enabled = below; 
        waterSurface.enabled = true;
        underwaterSurface.enabled = false;
    }

    if (waterLevel > transform.position.y && !below)
    {
 Debug.Log("Entering water");
        audio.clip = uAudio;
        audio.Play();
        RenderSettings.fogDensity = uDensity;
        RenderSettings.fogColor = uColor;

        below = true;

        glow.enabled = below;
        blur.enabled = below;
        waterSurface.enabled = false;
        underwaterSurface.enabled = false;
    }
}

The "SubShader commented out" is a message you get with many shaders that are auto-converted from Unity 2.x to Unity 3. Not sure if the Island Demo will eventually be updated but I guess not, so at this link you will probably find the old demo which needs a few fixes to work properly with Unity 3.

I followed the instructions and found that it works so to make it easier for everyone I have created a modified version of the original Island Demo stored on my server for you to download.

You can download it from http://z01.co.uk/downloads/island_demo.zip. This compressed folder is the original Island Demo modified using the above instructions to work with Unity 3.

I cant get this to work! I still got the message (Assets/Scripts/UnderwaterEffects.js(23,38): BCE0022: Cannot convert 'UnityEngine.GameObject' to 'float')

I have even try to change water.gameObject; to water.gameObject.transform.position.y

but still not working...

var waterLevel : float; var uAudio : AudioClip; var aAudio : AudioClip;

var uColor = Color(1,1,1,1); var uDensity = .05;

var aColor = Color(1,1,1,1); var aDensity = .008;

var waterSurface : Renderer; var underwaterSurface : Renderer;

private var below = false; private var glow : GlowEffect; private var blur : BlurEffect;

function Awake() { if(!waterLevel) { water = FindObjectOfType(Water); if(water) waterLevel = water.gameObject; } aColor = RenderSettings.fogColor; aDensity = RenderSettings.fogDensity;

glow = GetComponent(GlowEffect);
blur = GetComponent(BlurEffect);
if( !glow || !blur )
{
    Debug.LogError("no right Glow/Blur assigned to camera!");
    enabled = false;
}
if( !waterSurface || !underwaterSurface )
{
    Debug.LogError("assign water & underwater surfaces");
    enabled = false;
}
if( underwaterSurface != null )
    underwaterSurface.enabled = false; // initially underwater is disabled

if (glow)
    glow.enabled = false;

}

function Update () { if (waterLevel < transform.position.y && below) { Debug.Log("Leaving water"); audio.clip = aAudio; audio.Play(); RenderSettings.fogDensity = aDensity; RenderSettings.fogColor = aColor;

    below = false;

    glow.enabled = below;
    blur.enabled = below; 
    waterSurface.enabled = true;
    underwaterSurface.enabled = false;
}

if (waterLevel > transform.position.y && !below)
{

Debug.Log("Entering water"); audio.clip = uAudio; audio.Play(); RenderSettings.fogDensity = uDensity; RenderSettings.fogColor = uColor;

    below = true;

    glow.enabled = below;
    blur.enabled = below;
    waterSurface.enabled = false;
    underwaterSurface.enabled = false;
}

}

Main Camera, Glow affect, Glow tint, choose black. DONE!!

Importing Island Demo into Unity 4.0.0f7

  1. Get the project from http://unity3d.com/support/old-resources/files/IslandDemo.zip (which is a 150M file)
  2. Unzip
  3. Open in Unity
  4. Choose fix now at the pragma strict warning
  5. Note the GUID cache rebuilding, script compile warnings and error, FBX import warnings and shader warning in the log (just ignore for now)
  6. Click fix now at the NormalMap settings warning
  7. Fix the error in UnderwaterEffects.js as per the answer from Jashan
  8. Comment out lines 13 and 31 of UpdateTreeColors.js
  9. Change the way that Glow is handled in UnderwaterEffects.js, again, as per Jashan
  10. Switch to the Islands scene
  11. Press run

Note, this should give a demo that runs. I’ve not looked into the various shader and asset import issues, so it’s highly likely that they’ll be problems in the demo. But it starts up and you can run around and do stuff.