I am trying to determine when the player is grounded or not, and using the desktop player, the method described below works perfectly, but when compiled to Android behaves rather weirdly, I am not sure if it is just delayed or what, but the bool it is updating is rarely what it is supposed to be.
The code used to determine if the player is grounded:
void OnTriggerEnter2D(Collider2D other) {
if (other.tag == "NormalGround") {
player.Grounded = true;
}
}
void OnTriggerExit2D(Collider2D other){
if (other.tag == "NormalGround") {
player.Grounded = false;
}
}
On desktop this works perfectly, as demo'd here by writing the grounded var to a text box on Update():
https://www.youtube.com/watch?v=CV0h18dz1cg
But on Android, it is almost as if the colliders are lagging:
https://www.youtube.com/watch?v=c66uw2_NhrQ
You can see at the end of the video that the var only changes after I have made the character jump... (the true false text is updated every frame so it's not updated on Jump()
This is how the colliders are set up:
The hierarchy:
The GO I am using for groundcheck:
How the platforms/ ground is set up:
1: The trigger used to detect when the player is grounded (visible in inspector)
2: The colliders used to stop the player falling through the sprites (not in inspector)
The Jump() code:
public void Jump ()
{
if (!(PlayerDoubleJumped) && (Grounded) || ((!(Grounded) && (!PlayerJumped)))) {
rb.velocity = new Vector2 (rb.velocity.x, JumpForce);
animator.Play ("JumpCycle");
PlayerJumped = true;
} else if (!(Grounded) && (!(PlayerDoubleJumped)) && (PlayerJumped)) {
rb.velocity = new Vector2 (rb.velocity.x, DoubleJumpForce);
animator.Play ("JumpCycle");
PlayerDoubleJumped = true;
}
}
This is how I am moving the player:
this.transform.rotation = Quaternion.Euler (new Vector3 (0, 0, 0));
rb.velocity = new Vector2 (RunningSpeed, rb.velocity.y);
Physics2D settings (default):
I am using Unity 5.5.0
Does anyone have any idea what the problem is here?


