A beginner’s intro to Scripting with JavaScript in Unity.
What is covered in this tutorial:
-Choosing the default Script Editor
-Creating a new Script
-Editing a Script
-Variables
-Function Update{}
-Viewing and Editing Variables in-editor
-Attaching script to a Game Object in the Scene
-”Playing” the Game


I don’t know if this is just me but I’m having a linking issue for the download button on this page… All the other ones work just fine. Just trying to help out with your launch. Great and exiting stuff guys!
Oh and…First!
Yup! The URL was missing an “H”.
Fixed and should work.
…And it works! Job well done citizen!
Definitely can’t wait for more of these!!! I’ve been using Blender Cookie for a little while, definitely going citizen soon!!!
Wow finally, I can get tutorials for unity.. I’m only 15 years, grade 9.. And this site is helping me, Thanks Wes burke
.. So far so good.
Sorry that was suppose to be a happy face
Grats on the sites release, looking forward to more Tutorials!
Either way GREAT WORK! <3
How long will the GSWU Series supposed to last? 1-15 Parts?
Excellent intro series to Unity, looking forward to watching more!
I’ve got 3.5.0 beta3 I can’t find UniSiTE
Hi Necrorrr- you are mostly likely missing it because you are using a beta version of Unity, which is bound to have some missing/glitched/half-baked issues.
Especially if you are just starting with Unity, it’s probably best to use the latest “stable” version of the engine
That should fix the problem!
What are you games on the Apple site?!
Jeremy Deighan
Hi Jeremy, just in case you don’t catch the other reply:
http://itunes.apple.com/us/app/cubekin/id399885978?mt=8
http://itunes.apple.com/us/app/2012-earth-defense/id396293615?mt=8
Just small games, but lots of fun to make in Unity and hopefully proves I DO know what I’m talking about
Thanks!
This is awesome, i worked in flash and i´m very good at ActionScript 3, i have for at least 2 – 3 month looking for a fun way to learn javaScript. This is it
GREAT !!
umm im not sure why, maybe its just cuz i downloaded unity 3.5 on my Mac
but when i try to look for “UnisciTe” i dont have it.
inside my “Unity” folder in my applications, i have “Documentation, documentation.html, MonoDevelop, Standard Packages, Unitron, Unity, and Unity Bug Reporter”
in “Documentation and Standard packages” i couldnt find any folders such as “Data, and tools”
… and in the folders that were there i couldnt find any that had to do with Uniscite
I think uniscite is only for Windows. I tried looking it up and couldn’t find it.
Hi Dan! What you are looking for is “Unitron”, on the Mac side of things- thanks for bringing that up!
Hey, very cool tutorial
but my camera doesn’t move over to the new location like yours. Your camera move looks animated, my camera only disappears at the previous location and appears at the new location in the next moment…
oh, i have found my mistake.
i wrote it into the function start section, so unity transforms the camera exactly at the start.
Of course it works into the function update section
by the way thank you for your great tutorials and sorry for my english
Glad you found the fix, and thanks!
Honestly, I’m pretty sure I should learn Blender more. Unity is very fun for me, I’ve had some background in scripting because I used to use Lua a lot. The best thing I can make in Blender, with a reference image, is a butter-knife. Decent texture and metallic material.
I would rather learn how to use C#, are they really different ?
Cool, C# is a faster script and is usually better in the end, but harder to learn than javascript, and can be cumbersome to work with at times.
Unfortunately I am horrible with C#, Gabriel or Wes may be able to make a series on it at some point though
-Alex
I was trying to slow the thePlayerSpeed way down. To decimals like .1, .5, etc. and it doesn’t seem to slow down lower than 1. Is there a special way to make unity understand numbers less than 1 but greater than 0 ?
it should handle decimals fine, make sure you are using a float variable and not limiting it anywhere else in your script, you can also use multipliers like finalSpeed = speed/10 if need be.
-Alex
everything i try does not work how do you get uniscite on mac???? follow your tutorials in mono and in unitron i typed exactly as you did and all i get is error message saying cant play till script is fixed please help this is only thing hindering me in starting to create a game
uniscite is no different to mono in that sense, check the console window and it will be showing an error with the script,
-Alex
so is uniscite the same as unitron then?
-chris
Pretty much, I write scripts in notepad sometimes, it really doesn’t matter what you use.
-Alex
As Alex said, uniscite/unitron/notepad- all the same at the core, will not effect how your code works. Give that error console a look, and let us know what errors it shows?
yay thanks guys i finaly managed to make a cube rotate lol do you know of any good sites for researching java script as im new to all this stuff im better at the arts design side of this and anything that can help me to better myself would be greatly appreciated.
Peace
-Wolf
The standard Unity reference docs are great!
http://docs.unity3d.com/Documentation/ScriptReference/index.html
thanks for tutorial and easy to learn but I had some script issue , am using MAC and when I want to use the UniSciTE file I couldnt find it and I was kipping follow you tutorial and I hv done every thing and when I wanted to play it as game mode it says you have to fix the complier script and heres my codes
var forwardSpeed : float = 3;
var turnSpeed ; float = 2;
function Update ()
{
//this is the forward speed that will actually happen
var forwardMoveAmount = Input.GetAxis(“Vertical”)*forwardSpeed;
//actual turn amount
var turnAmount = Input.GetAxis(“Horizontal”)*turnSpeed;
transform.Rotate(0,turnAmount,0);
}
and it says on the burrem of the unity Assets/Control Script.js(14,45): BCE0051: Operator ‘*’ cannot be used with a left hand side of type ‘float’ and a right hand side of type ‘Object’.
Assets/Control Script.js(7,17): BCE0049: Expression ‘float’ cannot be assigned to.
also when I want to put turnAmout it says not match
I need help with that to fix it
Hi Mustafa,
UniSciTE doesn’t exist for Mac- don’t worry, you can just leave that alone and use the default MonoDevelop tool. Heck, you could use Notepad, and it wouldn’t matter
Also, you need to declare the type of variable that “forwardMoveAmount” is, like you did in your upper variables.
Also-also, your “var turnSpeed” line is using a semicolon, where it should use a colon.
Give those a check, then see if things are still broken!
I’m new to scripting, I typed everything like you did but it only moves my camera once and stops there.
Not sure how to fix it.
Hi Ram- first and foremost, drop in some “Debug.Log()” commands. They’ll let you see exactly what your script is doing, and when, and where it stops/breaks.
Second, double check and walk through the video carefully, makes sure you have everything exactly the same. Citizen members are able to download the source files, if that helps.