Unity-DirectInput icon indicating copy to clipboard operation
Unity-DirectInput copied to clipboard

how to support the IL2cpp

Open yanganggithub opened this issue 1 year ago • 1 comments

build with IL2cpp,find not working use this Library

yanganggithub avatar Aug 29 '24 08:08 yanganggithub

Just commenting here in case anyone else runs into this problem, the solution is fairly easy

In DirectInputManager.cs simply add these two lines above the OnDeviceChange function then it will work perfectly in il2cpp builds! It just needs a MonoPInvokeCallback and a delegate for that callback. Not entirely sure why but it works

public delegate void deviceChange(DBTEvents DBTEvent); [MonoPInvokeCallback(typeof(DIManager.deviceChange))] private static void OnDeviceChange(DBTEvents DBTEvent) { ODCDebouncer.Debounce(() => { ScanDevicesForChanges(); }); }

Hondune avatar Aug 30 '25 11:08 Hondune