gindemit/unity-rlottie

WebGL support

H-Maverick opened this issue ยท 11 comments

Will it be any support for WebGL ?

Hello, thanks for the question!
I haven't tried to build the plugin for web gl. I am affraid that it is not possible since the rlottie cpp library uses a lot of multi threading. But I'll write done into my todo list to try it out.

Thanks a lot, i hope it is supported

would love this too.

This error on WebGL

WebGLBuild.framework.js:3 DllNotFoundException: Unable to load DLL 'LottiePlugin'. Tried the load the following dynamic libraries:

But i think we already know that

WebGLBuild.framework.js:3 DllNotFoundException: Unable to load DLL 'LottiePlugin'. Tried the load the following dynamic libraries:

WebGL native plugins are static libraries and should be using the special __Internal DLL name, just as it's done for iOS.

I am affraid that it is not possible since the rlottie cpp library uses a lot of multi threading.

It seems you must build rlottie with LOTTIE_THREAD_SUPPORT defined for multithreading to be used. I don't know how the WebGL static library was built, but if threading support is disabled in it, it's quite possible that it will just work.

Hello everyone, I've searched all over the search engines and haven't found a good solution. Have you solved it?

Hello @zaixiaoqu, I spend few days on it long time ago without any success. I would love to add the web gl support to the plugin.

WebGLBuild.framework.js:3 DllNotFoundException: Unable to load DLL 'LottiePlugin'. Tried the load the following dynamic libraries:

WebGL native plugins are static libraries and should be using the special __Internal DLL name, just as it's done for iOS.

I am affraid that it is not possible since the rlottie cpp library uses a lot of multi threading.

It seems you must build rlottie with LOTTIE_THREAD_SUPPORT defined for multithreading to be used. I don't know how the WebGL static library was built, but if threading support is disabled in it, it's quite possible that it will just work.

Hello @gindemit, Thank you so much. I used @gilzoide 's open source code (https://github.com/gilzoide/unity-lottie-player), It successfully runs in the webgl environment. I think @gilzoide should have solved the problem according to the two methods he provided himself above.

Oh, thanks @zaixiaoqu for pointing this out. I will take a shot again to solve this problem.

Yeah, I had to disable rlottie's threading support (that is, build it without LOTTIE_THREAD_SUPPORT defined) for it to not crash the game on WebGL. On CMake, setting LOTTIE_THREAD option to OFF on web builds should do the trick.
That plus using [DllImport("__Internal")] should work =]