Unity – Game build using two different PC’s and tweaked Timer Script.

Lets be honest, it is easier to stick with one PC for making your game.  I have my personal home Windows 10 PC and the work Laptop, zipping up the working files and then chucking them onto One Drive and downloading them the other end.

It works, well, most of the time.  You must make sure both machine are configured exactly the same, all variables setup and any extra bits like OpenSSL and SDK add-ons installed on one PC are on the other – basically so when you open the files on what ever PC the infrastructure is the same… the one thing I find has been a pain, is the debug.keystore and hash keys.

I have my home PC working fine, with no major niggles.  The work one is kind different as I have folders not in default locations due to domain setup.

I think I may have to lean on doing the coding now from home as it will probably be untenable at work for obvious reasons…

I have a few more core game mechanics to iron out before cracking on with level designing.

Managed to tweak the PlayerPref system for the best time (Previous time) so it loads on each level without a separate key for each.  It works with using an identifier like this:

using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class Timer : MonoBehaviour
public Text timertext;
public Text pttext;
public float levelTimer;
public bool updateTimer = true;

public void Start()

if (!PlayerPrefs.HasKey(SceneManager.GetActiveScene().name + “BestTime”))
PlayerPrefs.SetFloat(SceneManager.GetActiveScene().name + “BestTime”, 0);

//levelTimer = 0;
pttext.text = “Prev Time: ” + PlayerPrefs.GetFloat(SceneManager.GetActiveScene().name + “BestTime”).ToString(“f1”);

public void Update()
if (updateTimer)
levelTimer += Time.deltaTime;
timertext.text = “Time: ” + levelTimer.ToString(“f1”); //Time to texture with 2 decimal

public void Finish()
updateTimer = false;
timertext.color = Color.green;

PlayerPrefs.SetFloat(SceneManager.GetActiveScene().name + “BestTime”, levelTimer); //Keep Complete Time for compare and save

Then my level selector scene has some additional code to generate a button upon the level being finished and adds the level number onto the newly opened button and allows the previous levels to still be played AND saving the times for each!

For a clearer explanation please contact me.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s