Search Unity

Bug new InputSystem, strange Error message? Moves on it's own?!

Discussion in 'Input System' started by Unity-Artcraft, Jun 24, 2022.

  1. Unity-Artcraft

    Unity-Artcraft

    Joined:
    Jul 28, 2018
    Posts:
    85
    Edit: I just saw on this forum, there is a page for input system, My too damaged brain saw it too late...

    Edit2: it worked fine after restarting Unity... but now, after restarting Unity again, the bug has returned. .... no clue what's going on with this new Input System.

    It is a fairly new project with very few in it, did a simple movement script with the new Input System and suddenly:

    Cannot find action map 'GamePlay' in actions 'Inputs (UnityEngine.InputSystem.InputActionAsset)'
    UnityEngine.InputSystem.PlayerInput:OnEnable () (at Library/PackageCache/com.unity.inputsystem@1.3.0/InputSystem/Plugins/PlayerInput/PlayerInput.cs:1620)

    Where does this so called 'GamePlay' come from?... I never created anything in this project called 'Gameplay' and now after this error message. the Input system broke and my player moves on own accord now. WASD are pressed down and set on .56f on both axis even though i don't touch the keyboard.

    my movement script: Inputs is reference to the generated C# script from my Input Asset

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.InputSystem;
    5.  
    6. public class PlayerController : MonoBehaviour
    7. {
    8.     Inputs playerControlls;
    9.     InputAction move, look;
    10.  
    11.     [SerializeField] float speed = 10;
    12.     [SerializeField] float maxSpeed;
    13.     [SerializeField] float rotationSpeed = 450;
    14.     Rigidbody rb;
    15.     Vector3 input;
    16.  
    17.     Quaternion toRoatation;
    18.  
    19.     Plane plane = new (Vector3.up, Vector3.zero);
    20.  
    21.     private void Awake()
    22.     {
    23.         playerControlls = new Inputs();
    24.         rb =GetComponent<Rigidbody>();
    25.     }
    26.  
    27.     private void Update()
    28.     {
    29.         input = new Vector3(move.ReadValue<Vector2>().x, 0, move.ReadValue<Vector2>().y);
    30.  
    31.         print(input);
    32.     }
    33.  
    34.     private void FixedUpdate()
    35.     {
    36.         rb.velocity += input.normalized * (speed * Time.fixedDeltaTime);
    37.         rb.velocity = Vector3.ClampMagnitude(rb.velocity, maxSpeed);
    38.  
    39.         Ray ray = Camera.main.ScreenPointToRay(Mouse.current.position.ReadValue());
    40.  
    41.         if (plane.Raycast(ray, out var enter))
    42. {
    43.             var hitpoint = ray.GetPoint(enter);
    44.  
    45.             var dir = hitpoint - transform.position;
    46.  
    47.             toRoatation = Quaternion.LookRotation(dir);
    48.  
    49.             transform.rotation = Quaternion.RotateTowards(transform.rotation, toRoatation, rotationSpeed * Time.fixedDeltaTime);
    50.  
    51.         }
    52.  
    53.     }
    54.  
    55.     private void OnEnable()
    56.     {
    57.         move = playerControlls.Player.Move;
    58.         look = playerControlls.Player.Look;
    59.         move.Enable();
    60.         look.Enable();
    61.     }
    62.  
    63.     private void OnDisable()
    64.     {
    65.         move.Disable();
    66.         look.Disable();
    67.     }
    68.  
    69. }
    70.  
    71.  
    72.  
    73.  
     
    Last edited: Jun 26, 2022
  2. Unity-Artcraft

    Unity-Artcraft

    Joined:
    Jul 28, 2018
    Posts:
    85
    Do Moderators or simliar things here have the ability to move this thread to "Input System" ? Would very much appreciate it. :)
     
  3. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,491
    I'll move it for you.
     
    Unity-Artcraft likes this.
  4. muhammad_ali_safdar

    muhammad_ali_safdar

    Joined:
    Jan 7, 2015
    Posts:
    15
    same issue in i.5.1 ...