I’m working on a game that will have dynamic context menus like in Fire Emblem or RimWorld. I’m using 2021.2.0b6 currently, with UI Toolkit (not the package) and Input System. Two questions:
- Whenever I play the game with a UI Document in the scene and Input System enabled, the error:
"InvalidOperationException: You are trying to read Input using the UnityEngine.Input class, but you have switched active Input handling to Input System package in Player Settings."
appears repeatedly. Since I couldn’t find any of the Event System components made for UI Toolkit when I tried to Add Component, I tried using “Input System UI Input Module (Script)” and it made the errors go away.
Is the Input System UI Input Module the new component to use with UI Documents in this version of Unity?
- What is the recommended way to use UI Documents? Should I have one document that contains all the different UI pieces, or individual UI Documents for each piece?
If I should use individual UI Documents, I’m not sure what to do to connect this to the Input System. The Input System “Player Input” component allows you to link a single Input System UI Input Module to it. I’ve done this with the one I made. However, if I make additional UI Documents with Input System UI Input Modules, I would not be able to link those to the same Player Input.
Does this mean I should use one UI Document for all UI elements and simply disable the pieces that aren’t needed at the time?