Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Resolved Input.GetAxisRaw returning (0,0) on Scene Load

Discussion in 'Input System' started by lack_05, Dec 5, 2020.

  1. lack_05

    lack_05

    Joined:
    Feb 20, 2019
    Posts:
    20
    Problem:
    I've seen a lot of forums about this similar problem and have tried many out to no avail. Here is my current situation and some of the tricks I've tried, I have a player that reads input through getaxis raw in an update function, when colliding with a 2D box collider it loads a new scene, sometimes it will allow for the player to continue walking when the button is held down in one direction. However, when I sprint (which basically adds +2 to the speed float) it will always return 0 or if I'm moving into a new scene I hadn't gone into it usually does as well. I know none of my other scripts are messing with the players input vector so it's the scene changing that resets it to 0.​

    Attempted Solutions:
    • Input.ResetInputAxes(): This was called in a coroutine and told to wait varying amounts of time to no avail. I called it out of a routine too and nothing changed.
    • Additive Scene Loading: I saw this was a lot of people's solutions so I spent a while getting it to work. It would keep the scene loaded and then reload a new one... just as I had feared the input would reset to 0 still.
    Conclusion:
    There's one other possible solution I know of where each scene is turned into a prefab and deactivated/activated when need be... I really don't want to have to turn each scene into a prefab and build a script to load them it seems a bit too excessive considering everything else is ironed out except this one problem, especially since the pieces are somewhat already there, the input does sometimes work which makes me a little hesitant to completely give up on this just yet.

    Any help would be appreciated!​
     
  2. lack_05

    lack_05

    Joined:
    Feb 20, 2019
    Posts:
    20
    Update:
    Since I had been getting impatient and wanted to get this working I decided to turn the scenes into prefabs and I still have the same issue! Now I at least know the problem isn't the scene changing but something else causing the change to reset. Is there anyway I could find out what is messing with my Input?​