- Home /
GameObject problem
In my scene I've an object with the HingeJoint, but If I Build the game, this object dosn't appears..and the game is very slow! and if I remove the HingeJoint from this object the G.Objects appears, and the game is fast.. why? In Play (in unity editor) it's all right!..
Maybe the settings of the HingeJoint are strange? I took a pic: http://img153.imageshack.us/img153/7681/ybbs.jpg
This is the script:
#pragma strict
var amount = 5.0;
function Awake ()
{
rigidbody.velocity = rigidbody.velocity * 0.0;
}
function Update()
{
if (Input.GetKey(KeyCode.R)) {
rigidbody.AddForce(transform.right * amount);
}
else if (Input.GetKey(KeyCode.T)) {
rigidbody.AddForce(-transform.right * amount);
}
else if (Input.GetKey(KeyCode.Y)) {
rigidbody.velocity = rigidbody.velocity * 0.9;
}
}
Sorry for my bad english, I hope someone can help me!
Slow...my guess is you have repeated errors at build time. The should be a outpu_log.txt
in your executable's data folder with the application's log. Run your app with the hingejoint, and afterwards, look at the logs.
Answer by Xtro · Aug 13, 2013 at 01:45 PM
Don't mess with velocity. In real world, you can't change the velocity of the objects. You can only apply them a force. It's same in Unity. See this page : http://docs.unity3d.com/Documentation/ScriptReference/Rigidbody-velocity.html
You don't have to set the velocity to zero on awake event. Remove that line.
Don't use velocity in KeyCode.Y case. Use AddForce just like in the other key cases.
I'm not sure if this is gonna solve your problem but this is gonna solve the other problems you have already.
The problem is not the script, because If I remove it, the problem is not solved.. :(
The problem is only the H.Joint.. i tried all.. is It.. But I don't undertand why!
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Problem with start game.exe 1 Answer
Chain Texture for Line Renderer 1 Answer
Executable won't start. 2 Answers
Android build problem! 1 Answer