Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Resolved Null Reference Exception

Discussion in 'Input System' started by NLTG, Apr 29, 2023.

  1. NLTG

    NLTG

    Joined:
    Apr 29, 2023
    Posts:
    1
    Hello,i am using the latest version of the new input system and i get a NullReferenceException.
    For some reason pi is null.
    I am using the automatically generated C# wrapper class.
    From what i understand the wrapper class is a class with a nested interface inside and i should be able to instanciate it just fine.
    If anyone can help me its much apreaciated-)

    Code (CSharp):
    1. PlayerInput pi = new PlayerInput();
    2. ...
    3. void OnEnable(){
    4.     pi.Enable();
    5. }