unity-rlottie icon indicating copy to clipboard operation
unity-rlottie copied to clipboard

WebGL support

Open Maverick-C opened this issue 2 years ago • 11 comments

Will it be any support for WebGL ?

Maverick-C avatar Jan 04 '23 14:01 Maverick-C

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.

gindemit avatar Jan 06 '23 09:01 gindemit

Thanks a lot, i hope it is supported

Maverick-C avatar Jan 06 '23 14:01 Maverick-C

would love this too.

enigmablue avatar Aug 14 '23 08:08 enigmablue

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

enigmablue avatar Aug 27 '23 11:08 enigmablue

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.

gilzoide avatar Feb 02 '24 00:02 gilzoide

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.

gilzoide avatar Feb 02 '24 00:02 gilzoide

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

zaixiaoqu avatar May 08 '24 01:05 zaixiaoqu

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.

gindemit avatar May 08 '24 15:05 gindemit

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.

zaixiaoqu avatar May 09 '24 02:05 zaixiaoqu

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

gindemit avatar May 09 '24 20:05 gindemit

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 =]

gilzoide avatar May 10 '24 00:05 gilzoide