- Home /
 
Scripting problem
Hi. I downloaded Unity 3d free version. I wanted to create a game. I modelled the objects in maya. I started the scripting, but my every scripts doesn't works. While I scripting, the program doesn't painted the correct commands, only the commands 20% painted. I saw many videos, but no one works. I tryed this in 3.4.2 and 3.5 . Is the problem that I have a free version?
My nature language is not english. Sorry for the mistakes.
Hi. Not sure what the actual problem is. Is it importing the models, or the textures. Attaching scripts to gameObjects. Do the scripts give errors. $$anonymous$$aybe show us what script is not working, what you are trying to attach the script to, what language do you program in (js, C#). $$anonymous$$ore information on the exact problem and hopefully someone can help.
http://www.youtube.com/watch?v=pgEwA_XnoH8
In this video, shows, how to create a collision. In 3:09 shows the script.
http://kepfeltoltes.hu/120413/$$anonymous$$_pkiv_g_s2_www.kepfeltoltes.hu_.png
First link. This is a Javascript. When I was typing, I received this message.
http://kepfeltoltes.hu/120413/464808125$$anonymous$$_pkiv_g_s_www.kepfeltoltes.hu_.png
The second link. Here is the full java script whats the video shows. And I put this in to the object, and nothing happens. The program doesn't paint the commands, you can see it, I don't know why. Is this a problem?
I'm a beginner of this unity, so I only know how to create the terrarian, and other things, but the program$$anonymous$$g ---> 0%
Answer by AlucardJay · Apr 13, 2012 at 06:49 PM
I couldn't see your pictures , but I think I can help.
Make a new script, then in the script write :
 function OnCollisionEnter(theCollision : Collision)
 {
     Debug.Log("Hit the " + theCollision.gameObject.name);
 }
 
               Make a Floor , name it "Floor".
Make a Cube.
Click on the cube.
Look in the Inspector window (very important) ->
There are these "Components" :
Transform
Cube (mesh filter)
Box collider
Mesh renderer
you should also give the cube a "Rigidbody" . If no Rigidbody is in the Inspector , add one like this :
Look at at the top of the Unity window ,
( File - Edit - Assets - GameObject - Component - Terrain - Window - Help )
click on Component , then click on Physics > Rigidbody . Now you should see Rigidbody Component in Cube Inspector (mass, drag, gravity, ....)
don't forget to drag-and-drop the script onto the cube also.
now Click on the cube , look in the inspector window , you should have :
Transform
Cube (mesh filter)
Box collider
Mesh renderer
Rigidbody
your script (Script)
now click play. Now the cube should fall down (gravity in rigidbody), and the message should appear "Hit the Floor" .
You need a rigidbody component for physics and collisions to work. Here is some information on Rigidbody :
http://unity3d.com/support/documentation/Components/class-Rigidbody.html
http://unity3d.com/support/documentation/ScriptReference/Rigidbody.html
Hope this helps =]
Thanks. It's work! You are a god. So.... The program$$anonymous$$g not enough, I must add any components to works?
Now I have a way to create a game. Now I know, what I have to do! Thanks!
for physics , yes you need a RigidBody (also for some collisions and triggers you also need it). Happy I could help =]
$$anonymous$$ore information :
Collisions : http://unity3d.com/support/documentation/ScriptReference/Collider.OnCollisionEnter.html
Triggers : http://unity3d.com/support/documentation/ScriptReference/Collider.OnTriggerEnter.html
Answer by badProphet · Apr 13, 2012 at 06:56 PM
I think you can get more help if you post some of your code but I'd recommend checking out Lerpz here if you're just getting started.
The Lerpz tutorial can be found here: http://unity3d.com/support/resources/tutorials/3d-platform-game.html
Answer by Lacee666 · Apr 13, 2012 at 06:56 PM
Hi.
http://www.youtube.com/watch?v=pgEwA_XnoH8
In this video, I'm trying to create a collision to the object. In 3:09, the video shows the java script.
http://kepfeltoltes.hu/120413/K_pkiv_g_s2_www.kepfeltoltes.hu_.png
In the first link, when I was typing, I reveived this message.
http://kepfeltoltes.hu/120413/464808125K_pkiv_g_s_www.kepfeltoltes.hu_.png
The second link. Here is my script. You can see, the program recognize my commands, but if the program recognized, the program will paint the correct commands. And every commands, I saw, didn't work. Only a few.
did you see my answer? I stepped out how to add a rigidbody, I think this is why yours wouldn't work. I wrote it following the video you linked.
Your answer