I added in visual script: on button input (Jump) – Add force (0/10)
Now, I can see that when i press the space bar the graph lights up blue for a second. Yet, my player wont move a single bit. Help please ![]()
I dont know about visual scripting but i can help you with c#. Dont worry you just have to add the player prefab to the script in the inspector and you are good to go…Make sure that the script name is exactly same as the class name and in your case it is JumpThePlayer
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
class JumpThePlayer : MonoBehaviour
{
Rigidbody2D player; // Drag the player Object to it in the inspector
public float JumpDistance = 10f; // How much high player can jump
public float JumpSpeed = 2f; //The Speed at which player will jump
void Start()
{
player = GetComponent<Rigidbody2D>();
}
void Update()
{
Jump();
}
private void Jump()
{
player.AddForce(0f , JumpDistance *JumpSpeed * Time.deltaTime);
}
}
