Search Unity

"Player.Input", not working in unity and not in namespace error.

Discussion in 'Input System' started by TTVstormz10, Aug 6, 2022.

  1. TTVstormz10

    TTVstormz10

    Joined:
    Aug 6, 2022
    Posts:
    1
    In unity, I was writing some code, and it would give me an error, saying that 'The type or namespace name 'PlayerInput' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?)', and here is the full code:

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.PlayerInput;
    5. public class inputManager : MonoBehaviour
    6. {
    7.     private PlayerInput PlayerInput;
    8.     private PlayerInput.OnFootActions onFoot;
    9.     // Start is called before the first frame update
    10.     void Awake()
    11.     {
    12.         playerInput = new PlayerInput();
    13.         onFoot = playerInput.OnFoot;      
    14.     }
    15.  
    16.     // Update is called once per frame
    17.     void Update()
    18.     {
    19.        
    20.     }
    21.  
    22.     private void OnEnable()
    23.     {
    24.         onFoot.Enable();
    25.     }
    26.     private void OnDisable()
    27.     {
    28.         onFoot.Disable();
    29.     }
    30. }
    31.  
    If you could please help me with this I would appreciate it, as I can continue on my journey to help others as well as me, make video games, code, and scripting. Thanks for reading my request, and I will look back to it in a few days. Bye!