Conversion - C# to C++

From a quick glance, that appears to convert C# to C++/CLI not straight C++. C++/CLI is effectively the C++ dialect of C# for .Net. Great for doing plumbing work for managed languages but it won’t help in this case because it still needs to run on the .Net run-time and expects a GC.

The syntax between C++ and C# is very similar so there is some scope for automatic conversion of logic and class hierarchy but the main problem is the change in memory models. Even a successful syntactic conversion leaves you a nightmare of a big lump of code that allocates memory all over the place and never frees it.

You really need to redesign your code for the change in memory management models between C# and C++.

I have ported a lot of code in both directions in the past and its not too bad really. Get some strong coffee and be prepared to write a few regexes in your editor for common replacements and you can motor through the code pretty quickly. It becomes quite meditative. Oh and make sure you have a test suite!

I have written a few tools to help port from C# in the past using NRefactory. I may adapt one to help with Unity conversions.