bsimser / Inventory-Pro

https://devdog.io
MIT License
2 stars 0 forks source link

Rewired breaks InfoBox #279

Open bsimser opened 5 years ago

bsimser commented 5 years ago

Original report by Herman Tulleken (Bitbucket: herman_tulleken, ).


@herman.tulleken Absolutely, it's further up but I'll post it here again: Updating to the newest version of Rewired on Unity 5.6.5 with the latest version of Inventory Pro logs this error in the console:

TargetParameterCountException: parameters do not match signature System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:188) System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115) Devdog.General.UI.UIUtility.get_isHoveringUIElement () (at Assets/Devdog/General/UI/Utilities/UIUtility.cs:65) Devdog.InventoryPro.InfoBoxUI.Update () (at Assets/Devdog/InventoryPro/Scripts/Modules/InfoBox/InfoBoxUI.cs:158)

I was able to reproduce this with a fresh project and install of Rewired and Inventory Pro on the Rewired and RewiredController scenes but the rest of the demo scenes do not output this error.

bsimser commented 5 years ago

Original comment by KungFuBrad (Bitbucket: KungFuBrad, GitHub: KungFuBrad).


I thought this would fix it, but it doesn't :/

#!c#

if (EventSystem.current.currentInputModule.gameObject.name.Contains("Rewired"))
                {
                    // Rewired InputModule
                    var eventData = 
                        (Rewired.Integration.UnityUI.PlayerPointerEventData)methodInfo.Invoke((Rewired.Integration.UnityUI.RewiredStandaloneInputModule)EventSystem.current.currentInputModule,
                        new object[] { Rewired.Integration.UnityUI.RewiredStandaloneInputModule.kMouseLeftId });

                    //Rewired.Integration.UnityUI.RewiredPointerInputModule
                    if (eventData != null && eventData.pointerEnter)
                    {
                        return eventData.pointerEnter.layer == 5; // 5 is Unity's UI layer
                    }
                }
                else
                {
                    // Default Unity InputHandler
                    var eventData = (PointerEventData)methodInfo.Invoke(EventSystem.current.currentInputModule, new object[] { PointerInputModule.kMouseLeftId });
                    if (eventData != null && eventData.pointerEnter)
                    {
                        return eventData.pointerEnter.layer == 5; // 5 is Unity's UI layer
                    }
                }