Whenever I try to add my auth in my Unity game I receive multiple errors, the first error being on load, “Not implemented icall: File :: DuplicateHandle”, then it provides "at invoke_iiii (webGL.framework.js:3:391519). The second error being “Win32Exception: Success”, not really sure what’s going on with that one, then lastly when I press my sign in button, I get the first error again.
Please note this only occurs on webGL and IL2cpp. If I build my game on windows/mono it works 100% without any errors, but as soon as I switch to il2cpp or to webgl I’m given errors. I’ve been stuck on this for a few days now… any support would be highly appreciated, thank you.
More generally, duplicating of handles it not support in IL2CPP because it is not possible to support it well on all platforms Unity support.
The key specific issue here is to determine what code in your project is trying to duplicate handles, and change that code. Hopefully the above debugging tips will help determine that.
Thank you for your response. So, I checked the documentation and it helped a little but not much. However, I did enable full exceptions and I received the same error “Not implemented icall: File:: DuplicateHandle” however, I did receive another error (image attached) .
If it helps any, I’m using GitHub - KeyAuth/KeyAuth-Unity-Example . However, I did remove System Threading and all functions attached to that (can be found in api.cs) and then the func.cs is the same concept, I’m calling KeyAuthApp.init(); on the start function (the init function is in api.cs) … hopefully you can help me out some more. I’m at a stand still and have no idea how to proceed. Thank you.
It’s not allowing my auth to initialize… I put KeyAuthApp.init(); then after that I put Debug.Log(“error”); (on func.cs) and it showed “error” … then shows this:
Sorry for the delayed response… so just to make this more clear I’m receiving these errors when building/running my application on webgl and IL2cpp (the application works 100% with mono/windows)
This works with Mono because Mono implements the DuplicateHandle API call. As I mentioned above, that is not implemented with IL2CPP.
The problem in the init method above is triggered by the call to Process.GetCurrentProcess().MainModule.FileName. For WebGL, there is no concept of a “current process”. So you will want to instead provide some different value for the “hash” key in the values_to_upload dictionary there.
So I removed the “Process.GetCurrentProcess().MainModule.FileName” … that was only there for hash/hwid checks but since it’s a free game I don’t really need it enabled anyways so I disabled it in my auth settings. However, now when I build/run the game on local it loads the Unity splash screen, as well as my splash screen but doesn’t load the login scene. I checked the logs and there are no errors. My auth just doesn’t want to initialize … any ideas?
I’m not familiar enough with the way the code in your project works to help, sorry. There are not great debugging options for WebGL. You could use Debug.Log statements, or build the project for Windows standalone player with IL2CPP, where you can enable script debugging.
If you would like to see the documentation I could upload it? I have all my auth functions in a class called api.cs . Then I have a class called func.cs which I call those functions. As you see in the pictures of the code that I sent above, both of those images are in my api.cs class. From my func.cs class on the start function I do KeyAuthApp.init(); . That’s all that I’m doing.
I also just tried to build/run it in windows IL2CPP and it works 100% fine. The login scene loaded and I was able to login with 0 delay. But again, whenever I try to build/run in webgl it doesn’t load the login scene at all.
I don’t think that documentation could help me too much - I suspect that you will just need to debug the issue. Unfortunately since it works on Windows/IL2CPP, it looks like you will need to use Debug.Log to check the behavior on WebGL.
Debugging it on Windows first though might be helpful to determine what the expected behavior is. Then you can use Debug.Log statements to validate that behavior on WebGL.