- Home /
Unity doesn't seem to find a class that actually exists
I have a script (and therefore a class) named GUIController (.cs), but when I try to "store" it as a variable to access it quickly, I just get Unknown identifier: 'GUIController' [TRY1] or The name 'GUIController' does not denote a valid type ('not found') [TRY2]
The code:
//Try 1
var GUIEx : Component;
function Start(){
GUIEx = GameObject.Find("Camera").GetComponent(GUIController);
GUIEx.LoadX();
}
//Try 2
var GUIEx : GUIController;
//Didn't even bother to write the code, got the error straight away
Answer by Eric5h5 · Jan 05, 2014 at 04:47 PM
Read the docs about script compilation order. But it would be better if you did not mix languages like this. It's not a problem mixing languages if you're dealing with things like functions in non-MonoBehaviour classes, but MonoBehaviour scripts of different languages just makes things more complicated, and sometimes impossible (if you have scripts that depend on each other).
Both scripts are in the same folder, Assets\\Scripts\\System.
$$anonymous$$oved GUIController to Assets\\Standard Assets. It worked!
I've posted a new answer with all the information
Answer by Side.MZG · Jan 05, 2014 at 05:40 PM
That was really helpful. The Unity guide says a lot of folders like Plugins. But only when I did create a Standard Assets folder under Assets folder in Unity 5.0 and put my cs class script in it, the JS script identified it!
Your answer

Follow this Question
Related Questions
A node in a childnode? 1 Answer
Add material component to object script-wise 4 Answers
how to disable a script component 1 Answer
2D Animation does not start 1 Answer
Modifying particle renderer material and assigning new particle emmitter 1 Answer