Search Unity

Switching Target Platforms: Incredibly Slow? Workarounds?

Discussion in 'Editor & General Support' started by MrLucid72, Aug 28, 2017.

  1. MrLucid72

    MrLucid72

    Joined:
    Jan 12, 2016
    Posts:
    988
    We support Mac64, Linux64 and Windows64.

    THE PROBLEM

    Even with cache server on, the switch on a 12gb project takes about 2 hours per platform.

    Then what makes it worse, it switches ONLY, at first, to x86 standalone instead of x86_64 (Why?! I didn't know it's still the '90s -- I mean, there's a poll pinned right now to even render the 32-bit version of the editor obsolete!).

    This means that, 2 hours later, I have to swap from x86 to x86_64 >> another 2 hours.

    In other words: This is unbearable.

    COLLAB

    When we used Collab, we found a workaround to make a 2nd and 3rd project -- I copied the Windows 64 project, would push, open Linux 64 project, and pull. This saved about 4 hours every time I wanted to swap.

    However, Collab was a bit too buggy for us and lacking features like local commit, so we switched to GitLab CE.

    GITLAB

    [Off-Topic] First of all, after disconnecting collab, 1/2 of our Unity bugs just went away. I had no idea how many bugs were linked to Collab (that were seemingly it's own issue).

    But now, we can't just open a new project -- the old workaround doesn't seem to work. I have a few ideas, but every test takes 2-4 hours O__o anyone have any insight? My ideas are:

    1. I found a script to cache library EDIT: This was full of errors and obsolete stuff :(

    2. Copy the .git dir to my linux project. Pull from same git repo.

    3. ......ideas? :)
     
    rocky1138 likes this.
  2. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,334
    We've just got different entire copies of the entire repo checked out for each project version. The overhead of waiting for the version change is simply not worth it.
    Of course, you'll want an actual build server that makes builds, but you still need to open the project checked out on a specific platform to see the bugs on that platform.

    The issue where you can't change directly from eg. Windows 64 bit to OSX Universal or back is a very, very large time cost, and fixing it would be very, very easy. Just don't have the editor immediately change when you select something in the dropdown, but wait for the switch platform button. That's how it works between other platforms, but on PC standalone, that's not taken into consideration.
     
    MNNoxMortem and MrLucid72 like this.
  3. MrLucid72

    MrLucid72

    Joined:
    Jan 12, 2016
    Posts:
    988
    Can you elaborate a bit further into this? Let's say I copy my project folder (.git folder and all). Would that suffice? Just pull from the same repo, but two completely separate project folders (well, 1 per platform)? Assuming I'd have to change ONCE for the initial platform change, of course. Am I on the right path?

    Exactly! I suggested this ages ago (surely others before me, too). It'd take a single person to fix this ;( so much time lost, even accidentally clicking it. I once closed Unity midway to see what would happen: it starts over, gahh....

    We're working on it, but not quite there yet. We swapped to GitLab CE and will prepare soon for their CI module, but we're not ready yet. Gotta still manually switch n build, for now. If you have any good guides on this (specific to GitLab CI), feel free to drop a link, if you have time!
     
  4. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,334
    No links for you there, we're running Teamcity on a server. We push to a repo on the server, and a hook starts a build for each platform. That's about what I know, I'm not in charge of that process.

    Pretty much. I've got versions of the project in:

    C:/WttW
    C:/WttW_OSX
    C:/WttW_Switch

    etc. Each of those are the same git repo checked out, with different build platforms (and graphics APIs, and other platform-specific things). You pull from a git repo on your computer in exactly the same way as you pull from a url, so if I've made changes on the OSX version and want those in the main one, it's just:

    git fetch WttW_OSX
    git merge

    Originally I created the OSX version with:
    git clone WttW WttW_OSX

    We strive to have the same code and assets over all platforms, to reduce confusion. Any platform-specific code lives in #if UNITY_PLATFORM-defines. The different repos are purely for handling re-import times.
     
  5. MrLucid72

    MrLucid72

    Joined:
    Jan 12, 2016
    Posts:
    988
    Haha wow I had no idea you could clone and do git functions from local machine. Thats pretty creative! Cool, well thanks for your help!
     
  6. Jbs_GameZone

    Jbs_GameZone

    Joined:
    Dec 14, 2018
    Posts:
    118
    Hi Baste, thanks for the detailed explanation. I'll try to replicate that setup, seems pretty straight fwd and will spare lots of dead times switching platforms.
     
  7. andreiagmu

    andreiagmu

    Joined:
    Feb 20, 2014
    Posts:
    175
  8. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    723
    We also spend a lot of time to try figure out different solutions and no matter if a cache server is used or not, the time wasted was ridiculous, so we went in the end with exactly what Baste recommends...
     
  9. injerto

    injerto

    Joined:
    Sep 22, 2019
    Posts:
    6
    uld you please explain this more elaborately? how do you set a local repo in your PC?
     
  10. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    723
    For git every git repository you checkout is a "local" repository. Just copy and paste your current folder to a second location
    e.g.
    repositories/Win
    repositories/Mac
    repositories/Android

    And as every repository works the same with git, you can do whatever you need no matter which one you used. So you just always open the Win folder if you want to open the project with target plattform windows, and the Mac folder if you want to do something Mac specific.
     
  11. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,334
    See my post. Instead of using the url of eg. a github repo when you do the operation, you use a file-path, and it works exactly the same.

    So eg:
    Code (csharp):
    1. git clone https://github.com/some/repository
    2. vs.
    3. git clone c:/some/folder
     
    MNNoxMortem likes this.
  12. calpolican

    calpolican

    Joined:
    Feb 2, 2015
    Posts:
    425
    So,
    1) I take my repo say "RespoOSX" and in the git terminal I do "git clone RepoOSX RepoAndorid".
    2) I open the folder of the new repo, "ProjectAndroid", in Unity and set Android as a build target.
    3) Then I keep working on "ProjectOSX" and commit changes to its repo. Whenever I want to build for Android, I...
    5) Open the "RepoAndroid". Then open the terminal and write "git fetch RepoOSX" and then "git merge".
    6) I open "ProjectAndroid" in Unity and build.

    Is that it? Have I understood this well?
     
    Last edited: Jan 17, 2020
  13. GamePyro-com

    GamePyro-com

    Joined:
    Jul 28, 2018
    Posts:
    197

    you found out how?