Crash on application quit if License Callback has run (Unity game engine)

I’m so close to having this all fully integrated with my Unity application. Everything works great except one thing. If I hook up the SetLicenceCallback and it runs in my application, then my application freezes when I attempt to close it. It’s as if it can’t shut down the process created by running that callback. It’s completely fine if I don’t hook up the callback or even if I quit the application before the server sync occurs. Do you have any idea why that might be happening? Or if there is a way I can manually unhook the callback during my application quit process.

I know you probably don’t officially support Unity as a platform to integrate with, however, everything is working great apart from this one thing. Any help with fixing it would be greatly appreciated.

Hi Chaz,

Can you try setting license callback to null before exit. Also ensure you are using LexActivator v3.9.2

Regards,
Adnan

Hi Adnan,

When I try setting the licence callback to null I get a null reference exception and I have checked to make sure that I am using LexActivator v3.9.2.

I’m thinking it may be something to do with how unity handles multi-threading, but not 100% sure. I am thinking as a work around I could create my own object that performs the IsLicenceGenuine check manually every sync period. Can you foresee any issues with doing it that way?

Kind regards,
Chaz

Hi Chaz,

After calling IsLicenseGenuine () function, you can start a timer which invokes this function with the frequency of server sync interval. That will work too.

Regards,
Adnan

Hi Adnan,

That’s great. That’s what I’ll do. Thank you very much for the help.

Kind regards,

Chaz

Hi,

Do you have any example code you could share on your Unity implementation?

Thanks,
Harvey.

Hi Harvey,

Implementation doesn’t depend on the platform. The code is the same. Please refer to the following:

Hi Harvey, I’m afraid I’m not at liberty to share the code that I wrote for this implementation as it is protected IP. However, I can confirm that the above issue was the only caveat I found when using LexActivator in Unity. I basically created a full screen panel GameObject which would block any users input, and have some login boxes to allow the user to put in the cryptlex licence key, then use LexActivator to perform the authentication and remove the login screen as appropriate.