Moving XNA (C#) project to Unity

Hi everyone,

I have a game developed some years ago on Visual Studio using XNA which can benefit from Unity’s features now that I know more about its features.

I’m still reading the docs and watching tutorials so I’m not very sharp at it.

I’m wondering about the effort I will need to put to migrate this.
For instance, in my XNA project I have some classes which are used/referred by others (e.g. a CubeArray class is an array of Cube classes) but I don’t see this kind of things happening in Unity - at least not in the games/tutorials I’ve followed - it seems that Unity paradigm is a bit different.

My questions are:

  • How usually games are migrated from traditional projects to Unity?
  • Is there good documentation describing that process?

Thanks,
Caio

Most cases of porting I’ve ever heard of usually go that they tossed/put aside whatever they originally had and rebuilt the code base. I have to imagine libraries (that don’t have many dependencies and are more modular) will have more likelihood of actually being useful without too much work. I would generally assume most of it will require enough reworking that you will be better off just putting it aside and remaking it from scratch.

Though this does not mean you necessarily have to start 100% from scratch. I would assume at least some of your code/algorithm is generic enough that you could simply translate them to Unity

Your general game logic shouldn’t be thrown out completely and can most likely apply in Unity, just written slightly differently

I’ve used both, started with XNA when it was first released but left once it became phone-centric. Been using Unity on/off for a few years, with a heavy dose of recent development. . .but. . .just look at your shaders. That’ll give you a benchmark :frowning:

You can obviously reuse all your assets :slight_smile:

Also all the logic etc would translate easily even if you had to recode it, the logic is fine.

My mindset is that the designed logic is probably fine, but I would be skeptical that the lines of code are usable or efficient. The less dependent on XNA libraries it is, the less worried about it I would be.

I’m the wary type though. Even if all I had to do to get something to compile and run was change Vector3d to Vector3, I would still be paranoid that some part is not running like what it used to.

I totally understand what you mean - Another situation where I feel just like this is upgrading an OS (Mac 10.8 to 10.9, for example), which is why I almost always completely reformat my computer and installing fresh OS instead of doing an upgrade :smile:

In addition to that, you’ll find that rewriting your game in Unity from scratch to be an excellent way to learn and get used to Unity!

1 Like

Thanks everyone for the support.

In the end it was easy to migrate everything, I had few conflicts between classes but I managed to solve it easy.

2 Likes

HI,

This topic is not so old, rather than create a new thread i prefer asking my question here:
What is the best conversion of these methods under Unity ? :

Quaternion.CreateFromAxisAngle Method (Vector3, Single)

Vector3.Transform Méthode (Vector3, Quaternion)

Unity - Scripting API: Quaternion.operator * (second overload)

Thanks for the reply. :sunglasses: