Hi! I’m working on a UI for a 2d game, and my jump button has a delay. Everytime I click it i can see a slight delay which bugs me and affects the way it should be played. I’m using an event trigger. Does anyone know how i can fix this issue?
P.S.: I am using the UI system that appeared in ver 4.6.
Edit: I set it up like this: when i hit the button I am changing a boolean value named isJumping to true, and using that value in my Update method with an if, if it’s true then jump. Is it because of this that i’m having this issue? Should I put the jumping code in a method and use that method in the event trigger? Would it work?
Edit: The code is quite simple:
//this is the method i use with the trigger
public void jump() {
isJumping = true;
}
//update method in which i have the actual jump code
void Update () {
if (isJumping && grounded) {
GetComponent<Rigidbody2D>().velocity = new Vector2(GetComponent<Rigidbody2D>().velocity.x, jumpHeight);
isJumping = false;
}