sinai-dev / UniverseLib

A library for making plugins which target IL2CPP and Mono Unity games.
GNU Lesser General Public License v2.1
116 stars 48 forks source link

Amazing stuff, little click through issue. #3

Closed krypto5863 closed 2 years ago

krypto5863 commented 2 years ago

Has a small issue where it's possible to click through the UI elements and select the stuff underneath. The stuff under is built in NGUI. Usually we've also had this issue when building plugin UI's with IMGUI so we resolved it in the meantime by doing something like this

if ((UnityEngine.Input.mouseScrollDelta.y != 0 || UnityEngine.Input.GetMouseButtonUp(0)) && UniversalUI.EventSys.IsPointerOverGameObject())
{
UnityEngine.Input.ResetInputAxes();
}

Would also like to ask if you could add a feature to make dragging entire UI windows around possible.

Thanks a bunch for this amazing library, been waiting for something similar for years.

sinai-dev commented 2 years ago

Will have to see how this behaves in other games, if there's no issues I can add this. Unfortunately the new InputSystem package has no equivalent API for ResetInputAxes, so not sure what we will do there.

As for dragging, I can add the UIPanel and PanelDragger classes from UnityExplorer into UniverseLib, will just have to remove some stuff that was specific to UnityExplorer first.

krypto5863 commented 2 years ago

That sounds great, thank you. In the case that you can't include the click-through fix, we can made do fairly easily, it's just a matter of adding the code block to the UI's update method, so don't worry if you just can't.

sinai-dev commented 2 years ago

Doesn't seem to cause any issues in other games so I may as well add it.

Also added PanelBase and PanelDragger, releasing the updated NuGet packages now. I'll update the docs with some examples soon.