Die Funktion des Einheitseingangssystems Onmove ist ungenutztC#

Ein Treffpunkt für C#-Programmierer
Anonymous
 Die Funktion des Einheitseingangssystems Onmove ist ungenutzt

Post by Anonymous »

Hey, ich habe das Tutorial der Unity Roll -Ball gefolgt, aber meine OnMove -Funktion scheint unbenutzt zu sein, dann wird sich mein Spieler nicht in Einheit bewegen.

Code: Select all

using UnityEngine;
using UnityEngine.InputSystem;

public class playerController : MonoBehaviour
{
private Rigidbody rb;
private float moveX;
private float moveY;

// Start is called before the first frame update
void Start()
{
rb = GetComponent(); //ref to player's rigidbody
}

void OnMove(InputValue movementValue)
{
Vector2 movementVector = movementValue.Get();

moveX = movementVector.x;
moveY = movementVector.y;
}

private void FixedUpdate()
{
Vector3 movement = new Vector3(moveX, 0.0f, moveY);
rb.AddForce(movement);
}
}

Einheit Windows

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post