Porting a plug-in from Unity to PlayCanvas

Hi all,
I’m looking to produce a PlayCanvas plugin which we have already built for Unity. Currently it’s a C# compiled DLL and some editor scripts. I have very little idea how to go about porting this into the PlayCanvas architecture, so any advice would be very much appreciated. I’d love to hear about referencing managed code dll’s from PlayCanvas (if that’s a thing even!?) or the dark alternative of having to re-write the entire thing in JavaScript / WebGL. Or anything in between…

Very broad questions I know, but any thoughts or comments are welcome to kick my progress off in the right direction.

Cheers :smile:

Weirdly enough the way that Unity does WebGL is convert C# to C++ then compiles C++ to Javascript using Emscriptem. Personally I’m not a huge fan of this for plugins, it does make sense for a single code base project but the result is a bit of a mess in my opinion :slight_smile:

You can’t reference managed code, so the result of whatever you do needs to end up being Javascript - like I say, cross compiling is definitely an option.

1 Like

Rewriting is usually is the way.
There is a huge difference between nature of platforms and languages (JS - C#), taking this in account usually rewriting it, will have very different implementation and better performance and adaptability on target platform.
Emscripten - is generally a “hack” and really weird beast, that usually you don’t want to do anything with.

2 Likes

Couldn’t agree more - that Unity WebGL stuff is a very strange beast