- Home /
Why compiler errors on a script that's not used in the scene?
I didn't have this problem yesterday. But today when I try to build a project it is giving me compile errors (" The name `aName' does not exist in the current context") on a script that isn't attached to or referenced from any object or component in the current scene. And in The Build Settings dialog only the current scene is checked.
The script in question is attached to a GameObject in a different scene that IS NOT LOADED. It is listed but NOT CHECKED in the Build Settings dialog.
Funny thing is I get no errors when I run it in the Editor.
Duh! I WAS doing something different that I didn't realize. Until now with this project I've been running in the editor and testing iOS builds. Today I Switched Target to $$anonymous$$acOS. Yesterday I was working on a different project for $$anonymous$$acOS and so I continued my train of thought of building to $$anonymous$$acOS with this iOS project. Sorry. And thanks for your help.
Answer by Eric5h5 · Jun 05, 2013 at 03:47 AM
All scripts are always included regardless of whether they are used in a scene or not. So you either have to fix the error, or remove the script.
Is there an easy way to remove all scripts that aren't referenced?