Hi Guys, Basically a newbie to the whole Unity thing…been wanting to mess around with the tutorial but I cant even get the thing started!
As soon as i try run the game, it says "Assets/Scripts/Camera/FadeoutLineOfSight.js(125,42): BCE0067: There is already a local variable with the name ‘newMaterial’
Anyone have an idea on what could be wrong?
really would appreciate the help and im sure its just a small little change i would have to make.
Hmmm without the code is hard to say something, I think that you should be declaring a variable two times inside a same function. For example
function lol()
{
var i : int = 0;
// do something
if( i < 0 )
{
var i = 0; // Error here, i is already declared ( at least in the unity's javaScript as I realized )
}
}
I bumped into the same issue as well when I started it up. I’m in the same boat as you , trying to learn this thing. I’m a bit of a novice programmer still but this is what I did to fix that… If you double click the error message, it should take you to the problem code in the unity code editor. In that same function newMaterial is already declared. In the end, where the focus is brought to when you double click that error message, it is re-declaring the same variable name. Its appears to be in a for loop to go through all the material objects and destroy them. So all I did was change the variable name in that new declaration from newMaterial to something else…(ie. someMaterial), You want to change the name of the variable in the destroy function call in that same block so it should show Destory(someMaterial). I saved it after that and it worked. I hope I explained it well enough to help you.