C++ Debugging

Hi guys,

We are a long-time game development shop with at least 20 titles published but all in C++. We are considering a change over to Unity for the tools pipeline and the cross-platform support. Can we use any of our code in Unity? How do you debug it? We have a lot of code so a monolithic dll seem like a bad idea. Can we have multiple dlls?

Actually, debugging is our biggest concern… by far. Print statements are not going to cut it. Any insight here would be helpful.

Also, debugging on Macs? Is that even possible with the Unity engine? :face_with_spiral_eyes:

Last problem… Lua. Our rules engine uses Lua so will we be able to use Lua, from a DLL, invoke that from the C# engine… etc?

Thanks

Hi,

You can use C++ libraries via DllImport from C#, but depending on the platform you’ll have to compile into different native library, but I guess you’re aware of that. Well, if it’s a C++ code, you debug it like you always do, on Windows Visual Studio I guess, on Mac - xCode or gdb, your choice. You can have multiple dlls of course.

Yes, you can do that of course.

I mean the things you’re talking about, are all possible. But your biggest obstacle is how well you can glue your code with Unity’s API.

Also, regarding debugging, if you’re for example, developing a game for Windows Desktop, you won’t be able to debug C# and C++ at the same time, because to debug C# you’ll need to use MonoDevelop which can’t debug C++, to debug C++ - you’ll need to use Visual Studio, but VS won’t be able to debug Unity’s C# code, because it’s based on Mono.

If you’re developing for Windows Store Apps, you can use Visual Studio to debug both C# and C++ at the same time, because Windows Store Apps uses Microsoft’s .NET instead of Mono.

Hope that helps.

Yes Tomas, that helps a lot.

Also, I got the impression that debugging on Mac (Dynamic Libraries) is impossible or next to impossible, at least for C++. Can this be done from within XCode? Mac doesn’t use dlls, so does that mean that I’ll need to ship two different versions of my game or is there some magic that we can do to write once-and-ship-anywhere?

I don’t know really, I am more a Windows guy, you better check OSX forums :slight_smile: But as far as I know you can use *.bundle’s which might work for you