Sponsored By

Porting an old Unity 4 game to unity 19 to be 64 bit compliant

This post is about porting an old Unity-4 game to Unity-19 before August 1st 2020 as Googleplay will discontinue publishing games that are not 64 bits compliant. 5 full days to go so it should’ve been easy, but believe me it was quite an adventure...

Thierry Brochart, Blogger

August 3, 2020

8 Min Read

So, as I’ve just written in the short description of this blog post, at first it can seem a very easy process. Let me tell you more about my game beforehand.

Two Racers! Is a simple android car racing game (actually a slot racing game) I made many years ago. To be honest the game didn’t have a good start and we all know the first month of visibility is critical. After that month, you probably need to kill it if it didn’t get enough downloads. Which I didn't and I’m glad about that because it took more than 2 years for my game to find an “organic” way to touch its target. Today it has more than 200K downloads and is steadily growing at the rate of 400 downloads per day. Not impressive but for me it’s the best numbers nowadays. Here is a screenshot of its downloads. Today is 2020 July 27


 

Why haven’t I updated it regularly?

  1. Because at first I thought I'd lost my encryption key after a crash of my old PC. Yeah I didn’t have a GitHub account at that time! I’ve finally found a way to recover my old HDD and got my key back. Anyway there was probably another way to do it, but I was so deceived by the numbers at first that I’ve preferred to forget about it. 

  2. The code is ugly : I was a beginner Unity developer at that time, scripting in my spare time in UnityScript which I didn’t master. Since I moved to C-Sharp and got a better grasp of the Unity Engine.

  3. It is a car racing game (actually a slot racing game) that used the old Unity wheelcollider and physics system, absolutely not compatible with the new one

So why would I want this game to be still available? Because it has this steadily growing audience and it would also be a way to open to making enhancements as I’ve been neglecting my players because of my laziness to make it evolve. And last but not least, It will also be a good momentum to add advertisements inside to start getting revenue from it. Because since 2014 Admob evolved and the advertisement system I used back in 2014 has been discontinued and I no more get revenue from this game, even if it’d be a few cents a month.

<>So there are many good reasons to update it and seemingly no difficulty ahead, right? Unfortunately not. So here is a journal of my attempt to do it.

 

  1. Day 1: Monday 27th of July 2020, the game has to be updated on sunday…

  • Firstly I need to organize myself. I do own a very old PC and have added one screen to the other to be able to have the old project on one side and the new one in front of me. Done.

  • Then I download and install Unity 4.7.2f1 which is the only version I can find on Unity website that can still run the project. Ok, installed and tested it, it runs.

  • Now i get my latest Unity 2019.4.5f1 with Android SDK. Done

  • I duplicate the project to work on it. Done.

Of course I already have many errors, incompatibilities and such. BUT I do have everything set up, so it’s time to dive into the project. I’ll update this journal this evening.

(This evening:)

  • I don’t know what I had in mind but all my files are scattered at the root Asset folder! Ok so first I organize it in folders, neatly and deleting unused files (a lot!) Done.

  • Create a dedicated  Git repository (I didn’t own a GitHub account back in 2014) Done.

Now for the scripts: All of my scripts are written in UnityScript so I have to re-write them all in CSharp. This will be the main trouble I’ll encounter until the end of the update.

(3 hours so far… call it a day!.. Plus one hour, couldn’t help coming back after dinner)

  1. Day 2: Tuesday 28th of July 2020, 2 coffees and “c‘est parti!”

    • Back to translate the old Unityscript into C-Sharp, not to mention to upgrade to the Unity API which has changed dramatically (and hopefully!)

    • Ok I progress, now no more syntax errors, I can affect the new (around a dozen) scripts to the game objects in my MainMenu scene. Just for info what I call my MainMenu scene is a scene from where you can launch the game but there is a demo race running in the background. Hence most of the scripts in my game are needed here too. I have to say that it’s a good thing that if you keep the same name of the scripts (except of course the .cs instead of .js) the values are still there in the Inspector, it saves a lot of time and errors.

    • From GUITextures to UI.Images, a move that needs some attention. Same thing with my old system of UI interaction that I replaced by more simple buttons.

Okay… So far I have the main menu (just 3 buttons, Play, Help and Credits) with a scene in the background supposedly being a race between two cars with still cameras showing the race from different points of views. The problem is that the old wheel colliders system is absolutely not compatible with the new one and to give you a feeling about the 2 cars on the track: it’s like to see two bulls angry and bucking… I think it’s not going to be that easy but I sort of knew that… Ok for now I’ll translate the scripts in the Help and Credits scene, to give me time to think about it (And after that a good cold beer and probably watching a movie on my sofa!)

  1. Day 3 Wednesday 29 th of July 2020: My sofa (and more than one beer finally) got the best of me for the rest of the day, yesterday! So here is a new beautiful morning in Reunion island (it’s the austral winter, around 78 °F) I haven't’ told you yet that I managed to translate the Help and Credit scenes, which weren’t difficult at all to do so but hey they weren’t going to be translated by themselves, would they? So today is the day when I have to make my cars drive perfectly along the track! WheelColliders, here I come! 2 Coffees (to make that light headache go away…)

  1. Day 4  Thursday 30 th of July 2020, Damn it… okay I have to admit those f* wheel colliders were worse than I have imagined. But guess what? I’ve finally managed to do it! Searching the Web for “magic numbers” for wheel colliders (many entries in forums about that) were not really helpful. I used a lot of the Unity documentation and there is a tutorial that is helpful to understand the system (this link) Ok so now that I’m back on track (car racing vocabulary!) I’ve managed so far to make two AI cars racing in the background of the main menu. Now is the time to construct the race itself, but it should be easy as everything is based on my previous work. (You should've heard me saying “it should be easy” I wasn’t that confident in my voice)

I’ve also managed to build an Android APK and tested it on my phone. It took me several attempts, like founding the right key (I had a cold sweat here when it was declined! Of course I’ve saved it somewhere else but finally found it!) and also I had to plug it into my PC via USB and debug it with the (excellent) Android Device Monitor: It was an old AndroidManifest file somewhere in a Plugins folder. Deleting everything did the trick. The apk successfully installed via update. Main menu is on my screen with the demo race in the background! First Victory! But there are still some other battles to fight… 


Anyway here is a screenshot of it, just because I’m proud of me!

  1. Day 5  Friday 31 th of July 2020

Okay I have to admit it was quite tricky to do the whole process, making a car game isn’t trivial anyway. Playing with the colliders was the last part to do. Right now I’m building the apk for a test. If the test is fine then I’ll add the advertisement system and I should be able to publish it... It is 8:30 pm and I hope to finish before midnight...

Hooray! I’ve made it to the Googleplay store, the new APK is in review (Update: It is published!) What will happen for my game then? Will it be successfully published in time? Will the update be free of bugs and contempt the actual players? Will the growth of its downloads follow the same curve? Will it finally give me some revenue out of the advertisement? To be continued :) But I feel like I’ve done the job, I can enjoy my weekend now!

Read more about:

Blogs
Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like