I have my librarys built in c++ such as AI, and want to use them in my browser-based game. But I notice the information in the document:
Unity Manual > Advanced > Plugins - Pro only feature
Unity has extensive support for C, C++ or Objective-C based Plugins. Plugins will work in standalones only. They are disabled when building a Web Player for security reasons.
Is it means that Plugins cann't be used in the browser-based game? Thanks!
Yes, you cannot use C++ plugins in browser based games. Allowing this would mean people could execute arbitrary C++ code on any user's machine, which would be a very big security hole. You can you managed C# dlls in the web plugin, though.
answered Nov 30 '09 at 09:15 AM
jonas echterhoff ♦♦
The problem with security would be that a malicious developer could basically develop a virus and spread it as a Web player, if he had access to C++ plugins from the Web player. With the integrated Mono-framework used for scripting, anything that could be harmful to the enduser's machine can comparatively easily be prevented ("sandbox"). Doing that for C++ plugins would be extremely hard (if not impossible), and it would take away the most important thing C++ plugins are used for: accessing hardware that isn't otherwise accessible.
You have one alternative, though: There's also a .NET-version of C++. Maybe you can compile your libraries to .NET assemblies and use them from within your game (that's possible with Web players).
answered Nov 30 '09 at 10:00 AM
I remember reading something about performance degradation for managed to not managed calls. How bad is it?
When I implement a managed c++ project, it becomes http://dot.net assembly and I assume that performance wont be different as calling regular c#? Is that right?
answered Nov 30 '09 at 03:30 PM