I have been following along the tutorial word for word, have restarted several times, redownloaded and reinstalled.
When it says to add the SpringFollowCamera script under the NearCamera object in the hierarchy I am unable to do so. It says "there is already a local variable named “NewMaterial” in the FadeoutLineofSite script.
Keep in mind I haven’t done anything different than what the PDF says to do. I just downloaded everything, followed along exactly, and ran into this error which no one else seems to have had from the tutorial. I am confused as to why I am the only one having this problem. Is it possible I installed Unity wrong?
I was having the same error and thought about changing the name to newMaterialA to make it compile, but I thought it might create another problem(since newMaterialA isn’t declared, I thought it would break the original functionality by changing the name…is this correct?)
“// All alpha materials are faded back to 100% // Thus we can switch back to the original materials”
Don’t know if it’s important, or what it does (I’m new) but wanted to preserve it. Assuming it does something, otherwise the creator wouldn’t have put it there.
So instead of changing ‘var newMaterial’ to ‘var newMaterialA’, I changed it to (line 125):
for (newMaterial in fade.alphaMaterials)
Destroy(newMaterial);
That should let it continue doing ‘it’s thing’. I think the problem was FadeoutLineofSight declaring the variable newMaterial more than once (i.e. var NewMaterial) because it’s already declared earlier in the script with (line 70):
for (var i=0;i<info.originalMaterials.length;i++)
{
var newMaterial = new Material (Shader.Find("Alpha/Diffuse")); //This is where newMaterial is declared for the first (and only) time, don't declare it anywhere else! or you will be eaten by a grue.
newMaterial.mainTexture = info.originalMaterials*.mainTexture; *