Hello, I've seen a script in the forum about reading / writing a string to a file with javascript. The suggested method uses a StreamReader / StreamWriter. StreamReader and StreamWriter are obviously not documented in Unity manual. Where are they? Where can I find a complete reference of javascript API supported by unity? Thanks, Eugenio
You mean .NET. You can search for classes like String and Streamreader here. Here's a page with an example: http://msdn2.microsoft.com/en-us/library/db5x7c0d(vs.71).aspx
I didn't realize that the javascript implementation in Unity is the one implemented/supported by mono. Is it? Thanks, Eugenio
The javascript may not be exactly the same, but you do have access to the entire .NET 1.1 API. EDIT: To look less idiotic.
It is not. The JavaScript in Unity was created by us specifically for Unity. The reason for this is that we wanted to make sure that we optimize JavaScript for the best performance and the result is that our JavaScript is around 20x faster than other JavaScript implementations. But yes it is based on .Net thus you have the full .NET class library at your disposal.
Ok, there has got to be some kind of complete reference out for the aspects of scripting in Unity that are NOT covered in the manual. I had a lot of success by reading beginner's JavaScript manuals recently and asking a ton of questions on the boards. However, these are not exhaustive/immediate resources. The JScript section on the msdn site seems to be pretty good, but I don't know if that is the best place to gain mastery of the scripting language we can use with Unity. I just want something I can refer to that is similar to the Unity manual, in that it gives you the basic use of something and a small code example to go along with it. You can be dangerous with just a little scripting knowledge if you have access to the Unity manual, but the manual by itself can't actually get you coding anything, and the tutorials are not complete references. Any alternatives to msdn? Muriac suggested the following, but I don't actually have a clue what I am even looking at when I go there. http://www.go-mono.com/docs/ Thanks!
Yes and no... any JavaScript reference will do. The language itself is pretty much the same across the board with a few minor differences, which I keep track of here: http://www.unifycommunity.com/wiki/index.php?title=Programming_Introduction MSDN site is fine to use, just don't use any Microsoft specific things (which are noted on the msdn reference), and be aware of the things Unity differs on in JavaScript(that url above). For the Mono Docs, just click on the "Class Library" link. The class library is essentially the .NET library, though all the examples are in C#, but I like the cleanness of the Mono docs. For an example, say we want some type of collection. Go to the "System.Collections". There you'll find Lists, Stacks, Queues... lets go to the "ArrayList". There is an example, but the real good doc is at the top where it says: See Also: "ArrayList Members" (which is a link). When you click on the link it will take you to a list of all the constructors, methods, and properties that can be used by that object, much like the Unity docs.
Just one :wink: http://msdn2.microsoft.com/en-us/library/yek4tbz0.aspx http://developer.voicegenie.com/ECMAScript.php http://developer.mozilla.org/en/docs/JavaScript_Language_Resources
Oh, and one more (this one is probably best): http://developer.mozilla.org/en/docs/JavaScript "Core JavaScript Reference" is nice.