GreenHell Modding
  • Welcome to the GreenHell Modding docs!
  • TUTORIALS
    • How to install GreenHellModLoader
      • Troubleshooting
    • How to install a mod
    • Mods in multiplayer
  • MODDING TUTORIALS
    • How to create a mod project
      • The modinfo.json file
    • How to create an AssetBundle
  • CLIENT - CODE EXAMPLES
    • Reading private variables
    • Modifying private variables
    • Accessing the player instance
    • Giving items to a player
    • Modifying the inventory max weight
    • Unlocking everything in the Notepad
    • Disabling player movement
    • Toggling the mouse/cursor
    • Printing to the console
  • WEBSITE
    • Slugs
Powered by GitBook
On this page

Was this helpful?

  1. CLIENT - CODE EXAMPLES

Toggling the mouse/cursor

PreviousDisabling player movementNextPrinting to the console

Last updated 5 years ago

Was this helpful?

In order to toggle the mouse/cursor we use the CursorManager , You have to only call the .ShowCursor() method once! As its "Requesting" the cursor.

If you request it too many times you will have to hide it the same amount of time! So only call this when opening your menu and when closing it, don't call it each frame while your menu is open.

// Show the cursor :
CursorManager.Get().SetCursor(CursorManager.TYPE.Normal);
CursorManager.Get().ShowCursor(true, true);

// Hide the cursor :
CursorManager.Get().ShowCursor(false,false);

Known issue : We don't know yet how to properly disable all actions such as opening the inventory, opening the character wheel etc. So it can be a little bit messy when using input fields inside menus. If you want to contribute to the modding research, join us on our .

discord