so i have this script error. I want to make the player jump when the left mouse button is clicked but it doesn’t work. I think its a really simple solution ,but for some reason i just dont know what to do.
So this is my script
using UnityEngine;
[RequireComponent(typeof(PlatformerCharacter2D))]
public class Platformer2DUserControl : MonoBehaviour
{
private PlatformerCharacter2D character;
private bool jump;
void Awake()
{
character = GetComponent<PlatformerCharacter2D>();
}
void Update ()
{
// Read the jump input in Update so button presses aren't missed.
if (CrossPlatformInput.GetMouseButtonDown("Jump")) jump = true;
if (Input.GetButtonDown("Jump")) jump = true;
}
void FixedUpdate()
{
character.Move( 1, false , jump );
jump = false;
}
}
something about this part is wrong
void Update ()
{
// Read the jump input in Update so button presses aren’t missed.
if (CrossPlatformInput.GetMouseButtonDown("Jump")) jump = true;
if (Input.GetButtonDown("Jump")) jump = true;
}
Please help me , thanks in advance !