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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Player Input Component cannot assign public script functions with proper InputAction parameter

Discussion in 'Scripting' started by YawnUser, Sep 6, 2021.

  1. YawnUser

    YawnUser

    Joined:
    Jan 9, 2021
    Posts:
    3
    Hey!
    I've decided to change my project from the old Input System to the new one and have encountered a problem. I've followed this video up until the point where you have to assign the functions from your script. It seems even with the functions being public and having the (InputAction.CallbackContext (name)) parameter the function cannot be found on the drop down menu. I've made sure that I've dragged and dropped the player Input component into my player script and my PlayerActions Input Action component into the "Actions" on the player input component.



    I'm currently trying to get a test function to work and sadly it has come up with nothing.



    The function looks like this



    It also does not read the functions on other scripts and functions.




    I've tried restarting unity and remaking the Input Action component thing. I've looked through tutorials and other threads and I'm not exactly sure what to do or what more information to give so please inform me! Thank you!
     

    Attached Files:

  2. YawnUser

    YawnUser

    Joined:
    Jan 9, 2021
    Posts:
    3
    I've figured it out. It seems I accidently put the Player script asset in the unity event instead of the Player Script that was actually on the player itself!
     
    Kurt-Dekker likes this.
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,951
    Absolutely INFURIATING error... I wish Unity would spend 15 minutes and specifically INHIBIT this ability. It would be SUCH a trivial fix to make. This stupid oversight constantly bites new users and they get completely blocked.

    https://forum.unity.com/threads/onclick-no-functions-shown.669334/#post-7328488