InvokeRepeating not working

Hi, I wrote this script with the help of another user, What I want is to made my character jump every 2 seconds and always be running, this character will not receive input from the player, so everything will be automatic, so far, I have this:

The jump function doesn’t work and the character just rise up in the sky, I would appreciate your help, thanks :slight_smile:

using UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour {
	public float speed = 10f;
	Vector2 input;
	 float jumpHeight = 700f;
	
	void FixedUpdate () 
	{
		float move = Input.GetAxis ("Horizontal");

		rigidbody2D.velocity = new Vector2(1, rigidbody2D.velocity.y);

		InvokeRepeating ("Jump", 0f, 2f);
	}
	
	void Jump()
	{
			rigidbody2D.AddForce (new Vector2(0, jumpHeight));
	}
}

t

You need to call InvokeRepeating() once in Start() and let it do it thing. You are calling 50 times per second, creating numerous InvokeRepeating() actions.