# Game engine like Unity 3D that allow me to use .NET code [closed]

I've been looking at Unity 3D for developing a 3D PC game and I really like the scene editor and how it simplifies the process of constructing 3D scenes, managing assets, animations, transitions etc. However, I don't want to restrict myself to using the Unity 3D scripts for handling every bit of game logic in the game.

E.g. If I want to construct a RPG dialogue system I don't want to do it with unity 3d scripts - I'd like to use C#/.net. Also, I might want to use e.g. windows azure and sql azure as backend, and use 3rd party .net libraries such as reactive-extensions etc.

Is there a .net engine out there that helps me with asset loading, animations, physics, transitions, etc. with a scene editor, but allow me to plug it into a visual studio .net project?

Thanks

• Unity scripts are written in either C# (with visual studio) or Javascript (with their own Unity IDE). – KlashnikovKid Sep 16 '12 at 14:03

The wording of your question suggests a misunderstanding of how Unity works (please correct me if I'm wrong), so I'm going to recommend you just try out Unity. "Unity3D scripts" are just .NET classes that inherit from UnityEngine.MonoBehaviour or UnityEditor.EditorWindow.

There's nothing stopping you from writing freestanding C# classes or pulling in .NET libraries (assuming they are compatible with Unity's version of Mono, which seems to cover the important parts of .NET 3.5). Whenever you create a dependency on something not included by default in a Unity release deployment (ie: System.Xml) Unity sees your using statement, sees what members of that namespace you use and automatically bundles in the correct assemblies from the standard Mono distribution that it includes (you can also drop in your own .NET DLLs).

So long as any third party .NET code works in the .NET 3.5 subset that Unity's version of Mono supports, you can use it. Be wary of libraries that provide too much abstraction, though, or at least use them sparingly. This is game development, not enterprise software.

We do some dynamic scene construction in our Unity project, and all of the data for that is handled in pure C#, no UnityEngine namespace references except for where it wouldn't make sense to re-implement a data type that Unity already has (ie: Vector3). We reference System.Linq and could use JSON.NET if we wanted (but that lib's a little fat, so we use LitJSON instead).

Is there a .net engine out there that helps me with asset loading, animations, physics, transitions, etc. with a scene editor, but allow me to plug it into a visual studio .net project?

Do you want to plug into a VS project because you really like VS and want to manage the project entirely from there, or is it that you want to use standard .NET assemblies? If you want to contain your whole project inside of Visual Studio, then your main options are things like OpenTK, SlimDX, MonoGame, or XNA and other's engines built on top of those. You'll also have do some work to build your own scene editor or integrate someone else's into your game.

I think you'll find though, that having your code and other assets exist in separate worlds can make things much simpler, especially if you bring an artist in later into the project.

If you want to step debug inside of Visual Studio instead of MonoDevelop, you can look at UnityVS.

And however you implement your backend is completely independent of your game's client code. The only mutual dependency between them should be the communication protocol.

• Very interesting. I'm interesting in using standard .NET assemblies things such as game logic, dynaically loading data (levels, high-score, etc).. not really necessary for the whole project to be in visual studio. I'd assume "unity's version of mono" would exclude any 3rd party libraries such as SQLite, RX extensions etc? – Pking Sep 16 '12 at 16:20
• Mono has SQLite (link). RX is a longer shot, but somebody's working on a port. Be sure to ask yourself if RX really adds enough convenience for what you want to accomplish, since additional layers of indirection are extra expensive in gamedev. – michael.bartnett Sep 16 '12 at 16:27

There is an open .NET implementation called Mono, which is used by Unity3D.

If you are OK with low-level access and you want to implement things by yourself, check OpenTK (for OpenGL) or SlimDX (for DirectX).

• Thanks. As you say, going with SlimDX means doing everything from scratch.. that's a lot of work cut out for you for even the simplest of 3d games. – Pking Sep 16 '12 at 12:50

There aren't too many. As an ecosystem, game engines tend to be dominated by C++, and when the engine exposes other languages, it's usually via a custom scripting. Your more evolved options include: