Would it be possible for Unity to be used as a frontend for an already existing C++ 3D game?


Let's say I have a game in C++, using DirectX9 as rendering API. I would like to make it available for people to play it in a browser using Unity, so Unity would start, download the necessary files and then "pass the control" (the render surface and input, I guess) to the C++ game.

Would this be possible? I know it would break cross-platform support, of course.

Thanks! Rui

Depending on the design of your game, you may be able to use some of the game logic code by using Unity Pro with its C++-plugins support for standalone games. Another thing that may be useful for that kind of thing is the low level rendering access.

However, you can certainly throw away all of the rendering code ... and: since Web players don't support external plugins, that also won't work. So, in the end, I'm afraid, the short answer is "no".

One possibility may be compiling some of the C++ game logic into .NET assemblies and using those. That wouldn't require C++-plugin support as you would be working with .NET DLLs (which aren't native). I'd recommend doing a little experiment with that before putting much work into it (might be that the way C++ is compiled to .NET isn't compatible with Mono or the Mono implementation that Unity uses).

On the other hand: The approach developing a game with Unity is so different, that even that possibility, I certainly wouldn't recommend it.