I have duplicated my Project so i have one mobile and one PC version. What should I use for source control so script changes from my PC project update the mobile projects scripts?
Duplicating the project is not the right approach here. Unity assigns IDs to each asset, and those will diverge over time between your projects. You should have a single project.
In terms of how you structure your project to support multiple platforms, there are various techniques for this. At the most basic level, your scripts can contain preprocessor directives to only include certain code if you’re on a certain platform. Unity provides a set of platform specific preprocessor constants you can use. They’re listed here:
From that page, for example, you’d use code like this to do something different depending on whether you’re building for iOS or PC:
public class PlatformDefines : MonoBehaviour {
void Start () {
#if UNITY_IOS
Debug.Log("Iphone");
#endif
#if UNITY_STANDALONE_WIN
Debug.Log("Stand Alone Windows");
#endif
}
}
In terms of your game assets, maybe you have higher definition versions of some models you want to use on PC, and lower res versions for mobile. You can either control that via LOD settings per platform, or you could use different assets entirely, and use asset bundles to control which assets are loaded depending on the platform.
Maybe you can specify some of the fundamental differences in your project depending on whether it’s running on Mobile vs PC? Either way, splitting the two projects will be a nightmare to maintain, and I really don’t recommend it.
As for which version control, it’s basically up to you and what you’re familiar with. But if you don’t already have a version control system you use, GitHub’s easy and a good place to start. It’s free as long as you’re okay with your source code being public, otherwise it’s a few dollars a month for a private repo.
When I build for mobile all of my assets go through a conversion process that takes a hour. Im wondering if I could duplicate my project and use a second PC to work on it?
If you duplicate your project you’re going to have a hard time merging any changes between the two projects other than your c# scripts and a few other asset files I would think. When you make changes to scenes or create prefabs you can run into a lot of trouble if you try to merge those, which means you could be in for a lot of duplication of work.
So if you just want to version control your scripts, you can use really any version control solution, and you should be within free tier limits on most of them. Unless you’re spitting out multiple mobile builds a day though, I’d probably just wait the hour for the mobile assets conversion so you can keep it one project.