Unity: How to Add Move and Jump Actions to Roll-a-Ball game with the Input System

preview_player
Показать описание
In this video I demonstrate how to add the Move and Jump actions to the Unity Roll-a-Ball example. I walk through the process of setting up a basic scene, adding the Input System package, setting up Move and Jump actions, and creating the PlayerController script.

Resources:
Рекомендации по теме
Комментарии
Автор

for a moment i tought my internet was down

X-Kingthestart
Автор

Love your Video
How do you get rid of Double Jumping so that the only way you can jump is if you are touching the ground ?
Thank you 😀

jodyclemons
Автор

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;

public class Playermovement : MonoBehaviour
{
private float movementX;
private float movementY;

private Rigidbody rb;

// Start is called before the first frame update
void Start()
{
rb = GetComponent<Rigidbody>();
}

void OnMove(InputValue movementValue)
{
Vector2 movementVector =

movementX = movementVector.x;
movementY = movementVector.y;
}

// Update is called once per frame
void FixedUpdate()
{
Vector3 movement = new Vector3(movementX, 0.0f, movementY);
rb.AddForce(movement*10f);
}
}

Hi, could you tell me what's wrong with this code, whenever, I play game, it doesn't take any of my inputs and the ball doesn't move.

deadwater