Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Managing multiple platforms for one game in Unity

TL;DR: My game should be different on PC and phone, can i manage these different version without just making multiple unity projects ?

Hello,

I am creating a game but i want some features to be different depending on the platform, i want it to be avaible from mobile but also from PC. But i have some differences:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

  • UI: on PC, the inventory and the shop should be always visible, on phone i want two buttons to open them, with of course lot of other differences in elements size, position…
  • Ads: i want the phone version of my game to have a banner ad on the bottom on the screen
  • Gameplay mechanics: i want on the phone version to have multiple event that randomly spawn, which grants bonuses (currency, boosters…) to the player after he watch an ad, i can only display ads on mobile so the events should only be avaible on mobile.
  • Real currency: i want a real currency shop, but i think it’s coded differently on computer and mobile.

What’s the best option for me now ?

  • Create the base game, then clone the folder and the repository so i have one for PC, one for mobile, and then implement the platform related features separately.
  • Same as above, but instead of different git repositories, git subrepositories.
  • Multiple git branches.
  • Something else ??

The problem with the two first methods is that if i want to implement a new feature that is not platform related, i need to code it on a project and then copy it into another, is there a better way for doing this ?

Thanks !

>Solution :

Yes, you should be able to manage different versions of your game for PC and mobile platforms within the same Unity project. You can use #if UNITY_EDITOR, #if UNITY_STANDALONE, #if UNITY_ANDROID, #if UNITY_IOS, etc., to conditionally compile code for different platforms. Have a look at Platform Dependent Compilation in the Unity documentation.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading