- Home /
Question by
QuantumRyan · Jun 03, 2011 at 05:47 PM ·
errornamespacecs0246
Project structure, finding scripts vis GetComponent and related errors
I'm not sure how to ask, but I found something a little strange. To explain, I have a camera I'm just trying to switch between my own custom MouseLook script, and the provided MouseOrbit script given in Standard assets. I simply do this to activate/deactivate Mouse Orbit:
//sample of enabling/disabling attached scripts
MouseOrbit myScript = GameObject.Find("Main Camera").GetComponent("MouseOrbit") as MouseOrbit;
myScript.enabled = !myScript.enabled;
My question is, why does the above work fine if MouseOrbit is in the "Standard Assests\Scripts\Camera Scripts" folder, but not if its in my "Scripts" folder?
The error I get is:
error CS0246: The type or namespace name `MouseOrbit' could not be found. Are you missing a using directive or an assembly reference?
Comment
Answer by QuantumRyan · Jun 03, 2011 at 06:08 PM
I found an answer, though I'd still be open to suggestions on good management of files. I'd like to be able to keep similar code together.