触摸不使用Unity UI工具包按钮
我有一个奇怪的问题,可能是一个简单的解决方案。
我使用新的 UI Toolkit 只有一个UI“游戏”。这是一种绘图程序。我的中间有一个拉动区域,侧面有“工具按钮”。在绘制时,一切都可以与鼠标,笔和触摸(使用脚本我可以访问所有类型的指针)一起使用,但是出于某种原因,触摸不仅可以与UI按钮一起使用。
即使是怪异的是,在UI按钮直接以Unity游戏模式进行测试时(我有一个触摸屏笔记本电脑)时,触摸的触摸是有效的,但是当我制作构建时不起作用。
在我的项目设置中 - >输入系统软件包,我有笔,鼠标和触摸屏活动在“支持设备”下活跃起来,
新的UI工具包如此新,我在网上没有帮助或类似的问题。
I'm having a weird issue, may be a simple fix.
I've got a UI only "game" using the new UI Toolkit. It's a little kind of a drawing program. I've got a draw area in the middle with "tool buttons" on the sides. Everything works fine with Mouse, Pen, and touch when drawing (using scripts I can access all types of pointers), but for some reason touch doesn't work with the UI buttons only.
What's even weirder is that touch on UI buttons works when testing directly in Unity Play mode (I've got a touch screen laptop), but doesn't work when I make a Build.
In my Project Settings -> Input System Package, I've got Pen, Mouse, and Touchscreen active under "Supported Devices"
The new UI Toolkit is so new there's no help or similar issues I can find online.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果仍然相关:
我遇到了相同的问题,并使用了“独立输入模块”,而不是Eventsystem中的“输入系统UI输入模块”。它说这是旧的选择,但对我有用:D
if its still relevant:
I had the same issue and used "Standalone Input Module" instead of "Input System UI Input Module" in EventSystem. It says it's the old option, but it works for me :D
我在这里添加触摸屏,现在可以使用。

I add the touch screen here and it works now.

自从我最终在其他地方找到答案以来,只是跟进。
在事件系统中的“输入系统UI输入模块”组件中,我将“指针行为”更改为“单个统一指针”,并将其修复。不知道这是否只是一个工作,但是现在效果很好。
Just a follow up since I ended up finding my answer somewhere else.
In the "Input System UI Input Module" component in the EventSystem, I changed the "pointer Behavior" to "Single Unified Pointer" and that fixed it. Not sure if that's just a work-around, but it works great now.