Raicuparta / uuvr

Universal VR mod for Unity games
https://raicuparta.com/rai-pal
GNU General Public License v3.0
87 stars 6 forks source link

Use Unity Default Keyboard Input API instead user32 wrapper #3

Closed netonjm closed 8 months ago

netonjm commented 8 months ago

Use Unity Default Input API instead user32 wrapper

Raicuparta commented 8 months ago

Using the user32 wrapper was actually by design. Because there are at least two different Input methods for Unity, so trying to access the Input class in some modern games would actually make it crash, since that class may not be present. In general, the least we depend on Unity APIs, the easier it is to keep the mod working consistently across Unity versions.

It can also be tricky for older games where the Unity API is slightly different. This is something I faced in another universal mod, but I'm not sure if that will matter much for UUVR, since this mod is unlikely to ever work on very old Unity versions anyway.

So if there is some reason to implement this change, we'd always need to either do a bunch of checks to see the correct way to check for input, or just fall back to the user32 wrapper if the Input class isn't available.

Is there something in particular you're trying to fix with this change?

netonjm commented 8 months ago

Gotcha and thanks for the explanation. I didn't know about the old compatibility issue, then make sense to close this PR.