- Home /
2D character stop immediately even when input buttons pressed
I have a 2D character that I want to stop immediately when a prompt pops up (otherwise my GUI buttons look weird and off center since they are drawn on the center of the screen). Unfortunately, there is some lag time to when my character stops. I'm using physics to move a ridigbody2D on my character to make it move. I've tried setting maxForce and maxSpeed set to zero, enabled kinematics, set the linear/angular drag to a super high number, changed my player controls to input.GetAxisRaw but no success. There's always a lag when from when the prompt pops up and the character stops and then my buttons are all wonky because they are following the player. Any suggestions for quicker response? Or maybe to get the GUI buttons to stop moving? The code for my GUI buttons being created are:
if (GUI.Button (new Rect (Screen.width/2 +40, Screen.height/2 +20, 150, 75), buttontex2)) {
//other code here
}
There is something else going on beyond the obvious here. That is, your button placement code is absolute, so they should not be moving. So there is something about your setup that you are not conveying in your question.