- Home /
Help how do i fix this error i can't figure it out.
This error -> if(water) waterLevel = water.gameObject; it says it cannot convert it?
You don't give nearly enough information for people yo be able to help you. Read this thread for a little guidance:
http://answers.unity3d.com/questions/133869/how-to-ask-a-good-question.html
Answer by poolts · Aug 08, 2011 at 10:10 PM
It's difficult to tell what you're trying to achieve here.
It would help users help you, but stating what it is you're trying to do with your code :)
But the reason you're receiving the error is that it looks like (what I presume is a int or float variable) into a game object. Additionally, the conditional if statement you've used should hold a boolean value, and I'm not really sure if it is in the context.
Elaborating on what you're trying to achieve with your code, would definitely help :)
I should have probably placed this as a comment under his question, however I shall leave it as a placeholder, in order to answer his question, and also as a re$$anonymous$$der to provide more information next time.
Hi All. I think this question refers to an error that occurs when trying to load the Tropical Paradise scene into unity 3.4. I just discovered it now.
The error code is:
Assets/Scripts/UnderwaterEffects.js(23,46): BCE0022 Cannot convert 'UnityEngine.GameObject' to 'float'.
The offending function is:
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 }
Your answer