|
Hello again, I'm very new to C#, but desperately want to start learning. However, I'm having some trouble with something that I'm pretty sure is very simple. In Javascript, I could easily do this... However, when I try to do something similar in C# I get an error saying "The type or namespace name "GodScript" could not be found. Are you missing a using directive or an assembly reference?" I'm not sure what's wrong, but I have a feeling I'll feel stupid when I find out lol.
(comments are locked)
|
|
First and foremost, try not to start your variable names with upper case letters. It makes it hard to distinguish them from types. You probably need to do this:
(comments are locked)
|

P.S. GodScript was written in Javascript. I don't know if that's relevant or not
That definitely has something to do with it. I remember reading something about the compile order of Javascript and C# on the docs somewhere, but there can be problems when you mix the two.
Meh...I'll just rewrite this script in Javascript I guess. That's what I get for wanting to learn C# halfway through a game project lol.
Here it is.
http://unity3d.com/support/documentation/ScriptReference/index.Script_compilation_28Advanced29.html
I would say it probably is easier to start with independent scripts, but you can affect the order things are compiled by changing the location. Otherwise you can't have C# dependent on JavaScript or vice-versa.
Is your GodScript type being defined anywhere the script can find it? If you're mixing and matching languages, take a look here to see what you have to worry about in terms of compile order.
edit: ya, what @sharat said