ScriptName and Visual Studio problem

I’m just starting out with Unity, and I’ve decided to go the C# route. I’m going through the Walker Brothers tutorials (which are done in JavaScript), so I’m having to translate the code as I go along. For the most part, this isn’t an issue and the Scripting Reference docs are proving very useful. However, I’ve come across an irritating problem where the code in the Scripting Reference does not work… The problem seems to be with the type ScriptName. For example, this line of code:

public ScriptName script;

…causes Visual Studio to generate the error: the type or namespace name ‘ScriptName’ could not be found.

So, what am I missing? I’ve done a search on the forums, and did come up with several topics relating to ‘ScriptName’, but I’ve not seen a solution to this problem. Most of the topics reference code using ScriptName as a variable type, which makes me think I’m doing something wrong… but I’m not sure what.

Any help would be appreciated.

public ScriptName script;

implies that there is a TYPE defined as ScriptName, which loosely means, you have something like

public class ScriptName : MonoBehaviour {
// Hey this is my script!!
}

defined in your code…

Aaah, I see. I understand now, thank you andorov.

As an aside (and for the benefit of others to come), the example code in the C# section lacks explanatory comments, but the JavaScript section actually has comments saying “ScriptName is the name of the javascript file”. Without the comments, ScriptName looked like a class name/variable type to a noob like me!

That is cause in UnityScript it is a class automatically with the name of the script file. in C# you need to have a class in with the same name to make it work as C# is class based only without code outside of classes - struct - enums basically