ManlyMarco / RuntimeUnityEditor

In-game inspector and debugging tools for applications made with Unity3D game engine
GNU General Public License v3.0
802 stars 98 forks source link

Unhook the mouse? #3

Closed KoolenDasheppi closed 5 years ago

KoolenDasheppi commented 5 years ago

I'm using this on Yandere Simulator, a Unity game. However, the game locks the mouse in the middle of the screen and hides it. So how do I use the F12 GUI that pops up?

ManlyMarco commented 5 years ago

Can you test if this build fixes the issue? test build cursor unlock.zip

wh0am15533 commented 5 years ago

You can always use a global key hook, which is nasty, or try to find the method that is disabling the mouse and reverse it to return MouseActive = true; Something like that. I believe that this is beyond the scope of this library. This isn't a solve all library, Some things are left to the developer.. hint hint...

Edit: if it affects the functionality of this library, such as the menu not showing or inspector not working, etc, that's another issue. but it sounds like according to your description that you just haven't done you own due diligence as a developer. Have you tried the REPL console to re-enable the mouse first?

ghost commented 5 years ago

I believe someone made a video regarding this: https://youtu.be/71h5bv7UCtw?t=1375

The game itself locks the cursor in the center.

KoolenDasheppi commented 5 years ago

You can always use a global key hook, which is nasty, or try to find the method that is disabling the mouse and reverse it to return MouseActive = true; Something like that. I believe that this is beyond the scope of this library. This isn't a solve all library, Some things are left to the developer.. hint hint...

Edit: if it affects the functionality of this library, such as the menu not showing or inspector not working, etc, that's another issue. but it sounds like according to your description that you just haven't done you own due diligence as a developer. Have you tried the REPL console to re-enable the mouse first?

I'm not a developer, I'm an end-user. Although I aspire to be a developer someday. But, basically, now the framework used to inject this library is giving me issues so I can't even test it.

wh0am15533 commented 5 years ago

Ahhh... Ok then let me try a few things any post back.

wh0am15533 commented 5 years ago

Ok. First, this is not an issue with this library, it is working as it should. Second, have you updated the game, BepInEx, or this library? The game has numerous points of locking/hiding the cursor, so you will need something the consistently sets the value of Cursor.HideCursor, since your not a developer that means somebody writing a trainer or mod for you. That isn't going to happen here as much as we'd like to assist. Since this all the sudden began happening, what changed? You might also find a mod or cheat at https://www.unknowncheats.me/forum/unity/

Note: also try the "\" (backspace key) key as the game has it's own debug menu that may show something of interest.

ManlyMarco commented 5 years ago

@kool601 It should be pretty easy to turn the modifications from the video into a plugin. Check this guide. What you need to do is make a new bepin5 plugin and add harmony patches for each of the changes (link to harmony wiki in the guide, read it). You will probably need to use transpliers to remove the offending code. To see what code to remove, in dnSpy select the code that you want to remove and "Edit IL instructions". You have to remove or nop-out these instructions in your transplier then. You can add the Update with hotkey to your plugin.

I made the editor forcibly unlock the cursor when it is open, but it can't currently keep the cursor position if it gets reset to the center. I could possibly fix this by hooking the Cursor class, but to do that I need bepinex 5 so it would break compatibility with bepinex 4.