Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

[New InputSystem] Compiler does not recognize ANY PlayerInput class methods

Discussion in 'Input System' started by lrsylux, Jul 8, 2021.

  1. lrsylux

    lrsylux

    Joined:
    Apr 2, 2020
    Posts:
    4
    The class works fine when just adding the Component but Unity does not recognize the class in script beyond the class declaration. Whtat's going on here?


    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.InputSystem;
    5.  
    6.  
    7.  
    8. public class TestPlayerInputDisable : MonoBehaviour
    9. {
    10.  
    11.     public PlayerInput playerInput;
    12.     void Awake() {
    13.         playerInput = new PlayerInput();      
    14.         playerInput.DeactivateInput();      
    15.     }
    16. }
    17.  
    ERROR: ssets\Scripts\TestPlayerInputDisable.cs(14,21): error CS1061: 'PlayerInput' does not contain a definition for 'DeactivateInput' and no accessible extension method 'DeactivateInput' accepting a first argument of type 'PlayerInput' could be found (are you missing a using directive or an assembly reference?)
     
  2. lrsylux

    lrsylux

    Joined:
    Apr 2, 2020
    Posts:
    4
    Solved

    I created an Input Action asset which I unfortunately also called PlayerInput which in turn created an .cs file called PlayerInput. S*** happens