Beginning Scripting

It would be real nice if there was a scripting tutorial for the API, AI’s for enemies, and more!
Also are you supposed to just memorize the API and different scripts?
Im new to this and really want to learn the unity language.
Every time I want to do something, I have to just look it up and I never know what to type.
Please Help
Thx!

Yeah, about that… I have a website that focuses entirely on teaching how to use Unity, so you could always start there! It’s in my profile. You can watch a couple free tutorials on it.

There is also http://unitytutorials.com/

i started Scripting a few Days ago too…

But the first problem i stuck with:
All tutorials ( and the Essential Book ) use javascript… i hate that…
Unity uses C# and Boo too…
But no Tut with that languages…

What’s wrong with JavaScript? For Unity’s purposes, the only real difference is the syntax. You can make it just as strict as C# with a simple #pragma strict at the top of your scripts, as well.

Some times C# just makes more sense…

For instance what if you want to declare an interface? What if you want to inherit from a MonoBehaviour script?
What if you want to use generics?

I must say though that if you know C# well enough to need to use these sorts of language features you shouldn’t have a problem converting the javascript examples yourself.

Well yes, that’s true. However, if you knew C# that well, you wouldn’t need to figure out which language to use, would you?

This is not what I mean. I mean that I dot know what to type because I dont know the language. What is the best way to learn?

The best way to learn is to study example scripts, experiment with them by changing values, adding your own stuff etc.

And it’s helpful to search and read the description and usage of every function that Unity includes from here;

example scripts???
I got the essential…
The Workshop Tutorials from the Ressource page…

But they are all javascript… and a little bit of C#…
How to learn Scripting C# with unity… if every **** Thing is javascript based?

Have a look on the Unify wiki. You’ll find more code examples there, some of which are in C#.

i would say it helps… but it doesn´t…

When there are that amount of different languages to use… Unity should have a manual, tutorial or workshop for each language… and not just for javascript…

The nice thing is, with the exception of UnityScript, these are standard languages that exist outside of Unity.

They each have plenty of websites out there with nice tutorials on them. Boo doesn’t have as many as C# as it’s not as widely used but it’s pretty easy to pick up.

90% of what you’re doing with either language is interfacing either the Unity API or the .NET (mono) APIs. Both of those are language independent and it’s just a matter of getting used to the language of your choice’s syntax.

The other 10% is language-specific issues like knowing how each one handles closures, classes, methods, built-in data types, etc. And this 10% is what those language tutorials are good for and are non-Unity-specific.

Also there are people here that use each language, so don’t be afraid to ask specific questions as you run into issues!

Well…it’s a lot easier to learn how to use the Unity API in the proper context. There are some areas where it’s not at all obvious, especially for Unity beginners, how some of Unity’s functionality should be accessed in C#, even if you know C# reasonably well. Having Javascript examples does little good in these cases. Some of this is because you have to jump through a number of hoops that Javascript/Unityscript avoids, since it was made specifically for Unity and C# wasn’t.

So it’s pretty clear to me that C# use in Unity should be covered better with more examples and so on, and Boo as well. For that matter, I’d also like to see Javascript in Unity actually documented properly as a language, because right now the only way to learn it is by the code examples, articles on the wiki, and reading many forum posts over a long period of time. I suspect that, even now, there’s still some Javascript functionality I’m unaware of that would be nice to know, if only it was documented. Because it’s certainly not web Javascript except in a really superficial way.

–Eric

Well even UnityScript is based on a standard… it seems to have the exact same syntax as Microsoft’s ‘JSCRIPT’, and there are plenty of docs for that on MSDN.

But I agree, with the large influx of newbies we shall soon see here, we need more docs on basic scripting. Fortunately, I believe the guys at Unity are already working on those.

Actually there are a fair number of differences between JScript and Unity Javascript, so while the MSDN JScript docs are more helpful than web Javascript docs, IMO it’s not really a substitute for proper docs in Unity.

–Eric

I didn’t find Boo easy to pick up the couple of times I tried to do so. I found nothing approaching a beginner’s tutorial on the Boo website. I assumed it was made for people who knew Python.

On the other hand, I noticed very few differences between JavaScript and C# as a beginner.

Well, I am speaking from the perspective of a professional programmer so I may find it easier to learn new languages than others with a different reference, granted. But it’s a pretty simple language, I think, as far as syntax and rules go. Also I do have python experience. The only thing that gives me pause in that language is just some of the names of the built-ins as they are different than the mono lib.

But again, with searching I found all the info needed.

I guess my point is that Unity shouldn’t be in the “teach C# or Boo” business but just how to use their API business. I still agree that multi-language examples would be nice though.

I don’t think that’s it. The JavaScript in the Unity tutorials made complete sense to me on my first day with programming. C and C# look basically the same to me as JavaScript.

Boo’s documentation is like “here’s how we would do this thing”, and then not tell you what that thing is. Terrible.

Are you talking about Boo’s site or in Unity?

And I guess I don’t disagree that the docs for Boo are lacking on the net – I was just saying I think it’s an easy language to figure out. But as you point out that view is mine and not universal. :slight_smile: