Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Official Announcement: Unity Teams and DevOps vision

Discussion in 'Unity Build Automation' started by MikeSaverUnity, May 5, 2022.

  1. Chris_Webb

    Chris_Webb

    Joined:
    Mar 18, 2014
    Posts:
    128
    Yup the pricing change is hilarious. Much cheaper to just buy a mac mini and plop jenkins on it than pay for even a single month. Been using cloud build since 2014, and next month I'll buy a mac mini. Luckily have plenty of experience setting up jenkins at my day jobs haha. It only takes a few hours, do look into it :)
     
    Novack, drawcode and PeachyPixels like this.
  2. jeremyfp

    jeremyfp

    Joined:
    Oct 14, 2013
    Posts:
    8
  3. Chris_Webb

    Chris_Webb

    Joined:
    Mar 18, 2014
    Posts:
    128
    Please look into setting up a jenkins build server. You can make one in a few hours, and if you only need windows hardware, it can be significantly cheaper than cloud build. Builds will also be significantly faster and more stable. The advantage of cloud build (zero upfront cost) no longer exists when the monthly cost is more than a one off purchase of dedicated build hardware.
     
    Last edited by a moderator: Aug 19, 2023
  4. Shredsauce

    Shredsauce

    Joined:
    Apr 4, 2016
    Posts:
    37
    Thanks for the suggestion! How much of a pain is it to get builds working for iOS with Jenkins? I managed to get my WebGL builds working and copied over to my server through Github Actions (which is free for up to build 2000 minutes per month, there's a good tutorial by yanniboi). But it's looking like iOS will be a little trickier since it has to go through xCode.
     
    Immu likes this.
  5. Chris_Webb

    Chris_Webb

    Joined:
    Mar 18, 2014
    Posts:
    128
    It's not difficult at all, definitely a solved problem with plenty of tutorials :) You do need mac hardware though, but a low spec, slightly old mac mini will more than do the job.

    https://cemayan.medium.com/jenkins-pipeline-for-unity-ios-7cf66b3608f
     
    crekri, Immu and Novack like this.
  6. Immu

    Immu

    Joined:
    Jun 18, 2013
    Posts:
    239
    Going exactly for the same route. I'm a 6+ years Unity user. Sad that Unity didn't cared about the legacy consumer and straight up removed our interest in their cloud service.
    I wasn't keen on doing my own build machine with remote call and learning jenkins etc... But in the end, I'd rather do that than pay for a service that was fairly cheap and flawed, now becoming ridiculously expensive for no radical improvement or fixes.

    Buying a machine and learning to use jenkins is much more cheaper than paying Unity Automaton, be it for solo devs or entire teams. (wonder who's going to pay their service now..)
    It's been around 2 weeks to understand and setting up everything. And I'm going from 0 knowledge prior that. It's worth the time !
     
    Chris_Webb likes this.
  7. zzzz789

    zzzz789

    Joined:
    Apr 11, 2022
    Posts:
    8
    We are likely to follow the same path. Mac mini or bust
    Any collection of resources on setting this up?
     
    Chris_Webb likes this.
  8. Chris_Webb

    Chris_Webb

    Joined:
    Mar 18, 2014
    Posts:
    128
    Yea I really don't know who this service is for now. Larger studios can easily afford dedicated, fast build hardware, and all of the control, reliability, speed and flexibility that entails. Smaller studios who previously didn't have the time or money to invest in a custom solution, now don't have the money for this solution. Extremely strange decision, but we all just need to suck it up and go the local machine route. It's better in the long run, and is honestly very easy. That's without even considering competitor cloud services, but there is no way I am trusting any of those at this point :)
     
    Immu likes this.
  9. Immu

    Immu

    Joined:
    Jun 18, 2013
    Posts:
    239
    Here's some insights, keep in mind I'm no expert tho, and I learned everything on the fly asking the internet.
    I bought a raspberry,
    https://www.raspberrypi.com/products/
    used my secondary computer as build machine (will be a mac mini in the future as an agent)
    How to Install Jenkins Agent on Windows
    made an openVPN connection between my build machine and my raspberry
    https://linuxhint.com/install-jenkins-raspberry-pi/
    made a connection from my internet box (opening ports..) to my raspberry
    https://www.pivpn.io/

    Then made a whole setup of 'jenkins jobs' on the jenkins installed on my raspberry.
    I can now calls them on my build machine, through my raspberry (both on the same local network), from remote control anywhere in my country.

    Took some days to learn how to write jobs through their interface (once jenkins is installed), but the overall thing is simple:

    • first job: update my repo from plastic scm (dedicated jenkins plugin) by entering repo and credentials
    • second job: batch command to build the game from repo:
    I define in the job variables for
    %ProjectPath%
    %LogPath%
    %MethodMode% (a custom script in my project that is called to set my define symbols of beta/public version, I don't use branches)
    %BuildPath%

    "C:\Program Files\Unity\Hub\Editor\2021.3.25f1\Editor\Unity.exe" -quit -batchmode -nographics -buildTarget standalonewindows64 -logFile %LogPath% -executeMethod %MethodMode% -skipMissingProjectID -skipMissingUPID -projectPath %ProjectPath% -buildWindowsPlayer %BuildPath%
    • third job: zip everything with FileOperation jenkins plugin
    I was already paying plastic scm and bunny CDN so that doesn't change much for me, and again, still way cheaper than anything automaton prices are for tons of services you won't care about.
    Other good advantages: not prone to weird/new errors you can't do anything about, never ending up with builds that suddenly takes 5 hours for no reason or weird bandwidth changes.

    (I didn't managed to make a job to install unity from the info of the manifest file in unity project yet, it requires authorizations to write/install I didn't yet managed to understood, so I'm manually installing corresponding unity version for now)

    -----------

    Again, sad to see this service and its team being pushed to go in this direction. Again, I know it was fairly cheap and I can make sense of the idea that the price could be increased, like 5 or 10% more, but certainly not 100% to 1000% more.
    I'm sure some money wo/man convinced with shady data that it was 'the best economic move' and some lead didn't do its job to step against it.
    Distrusting legacy users and adopting on the quick greedy tactics never got compagnies profitable on the long run. It's quick easy money, but just for some time, you know this is going to hit a wall. Unity already had a lot of miscommunication, but here it was miscommunication + very bad decision.

    I was a perfect evangelist for unity services, telling people how great it was (despite its many flaws), and now those tactics and the way they've been introduced turned me into a living warning sign for anybody being interested by them.
    I wished this service to improve. Not to get lost the way it did. (But who knows, miracles happen, higher ups, leads or bad decision makers gets sometimes fired..)
    My sincere appreciation to the Unity team members who are feeling the same but can't act upon it : (
     
    Last edited: May 22, 2023
  10. Chris_Webb

    Chris_Webb

    Joined:
    Mar 18, 2014
    Posts:
    128
    zzzz789, Novack and Immu like this.
  11. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    678
    Hi @JGasimov

    Thanks for reaching out regarding DevOps and the new UBA pricing regime.

    I suspect most of the answers you're seeking are covered in this thread, along with others in this (and the DevOps) forum.

    But if it helps, I can summarise my main concerns as an indie dev and the impact these changes will have? (and post them here)
     
  12. LorenzoNuvoletta

    LorenzoNuvoletta

    Joined:
    Apr 28, 2014
    Posts:
    54
    Just curious, is any developer going to continue using Cloud Build at the new price?
    Would love to hear their opinion on why, maybe I am missing something.
     
  13. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    8,988
    new pricing kicks in sometime in june for old customers i think.

    then need to reduce builds and look into sideloading ios apps,
    could build ios apps locally at that point (apparently ios 17 might allow it).

    The Share feature in cloud build is/was really useful for inhouse apps.
     
  14. Chris_Webb

    Chris_Webb

    Joined:
    Mar 18, 2014
    Posts:
    128
    There are two ways to nicely duplicate (and improve?) cloud build sharing using your own build hardware.

    You can upload builds directly to testflight from the commandline using altool, and they automatically update on device (with testing notes and everything). I do this nightly. From here builds can be trivially pushed from internal to external testing, and even to submission.

    Alternatively, and more similar to cloud build, you can use ad-hoc provisioning. Upload your build to aws/some ftp from command line, then include a manifest, and a special download link. You/your testers can then download your build directly from you. See "Use a website to distribute the app". This is functionally identical to cloud build.

    https://support.apple.com/en-au/guide/deployment/depce7cefc4d/web

    For android, you can trivially push to google play alpha/beta release tracks from the command line (again, I do this nightly). You can also just offer the raw apk download links from your build machine and that can be used just fine.
     
    Novack and mgear like this.
  15. Shredsauce

    Shredsauce

    Joined:
    Apr 4, 2016
    Posts:
    37
    I'm glad I followed @Chris_Webb 's advice to set up a build machine with Jenkins. I got my Mac Mini Jenkins build machine working mostly the way I want it to. Right now I've got it building for iOS, Android and WebGL. The iOS dev build gets uploaded to my server where I can Install it on my phone the way Cloud Build did. I also have an option to upload the release version to the app store, same with TestFlight. The WebGL version builds and then uploads to my server as well and sets the build description to a link where I can play. The Android version just gives me an APK for now but I'm going to go with Chris's suggestion and have that push to Google Play. All the configurations have options for clean builds and they all run nightly. I'm using Google remote desktop to access my build machine. It's a little ghetto but it works for now.

    One thing that I used a ton with Cloud Build was building from a git commit id. It's useful for debugging. I've found that you can do the same with Jenkins by using a string parameter named COMMIT_ID with the default value as "*/master" (or whatever your default branch is) and then setting "Source Code Management" -> "Git" -> "Branches to build" to ${COMMIT_ID}.

    Overall this solution has been working way better for me. There isn't anything special that I needed from Cloud Build that my build machine doesn't do. My builds are way faster now and I have more control over the configurations. Other than my time, I'm only paying for the upfront cost of the Mac Mini itself and the electricity to run it. I can build every minute of every day now without going broke. But I wouldn't go back to Cloud Build even if they made it free.
     
    Last edited: Jun 9, 2023
    Tanek, AcidArrow, zzzz789 and 3 others like this.
  16. Chris_Webb

    Chris_Webb

    Joined:
    Mar 18, 2014
    Posts:
    128
    This is really awesome to hear! Glad it has all worked out for you :) It's genuinely pretty fun hey :D
     
    Shredsauce likes this.
  17. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    678
    Thanks for the detailed feedback. This is an option I'm exploring, along with other CD\CI services.

    Unless Unity have a change of heart and are able to offer something that works for indies or small teams (as Teams Advanced did) then UBA is just not going to be my long term build solution.
     
  18. unity_DDA77FA296C3E6002ABD

    unity_DDA77FA296C3E6002ABD

    Joined:
    Jan 30, 2023
    Posts:
    1
    Any news on whether Unity is changing their mind on their pricing?? (Which is insane btw) We're also planning to completely leave Unity Build and probably do some jenkins as well
     
  19. wrossmck-unity

    wrossmck-unity

    Unity Technologies

    Joined:
    Nov 9, 2021
    Posts:
    87
    Hey folks,

    I figured it was overdue for me to respond to many of the topics raised in this thread.

    We will not be changing our minds on the current pricing model. Having an unlimited usage and flat-rate deal made it impossible for us to invest in the product the way we want to, and a consumption-based pricing model enables us to offer more value at an appropriate price to offset the costs of providing that value.

    We are actively investigating ways to accommodate studios of all sizes including indie devs. That means we are looking at lower cost options as well as higher performance options. The first of these new options will be launching very soon has launched on June 28th.

    Additionally, we are looking into ways to offer different kinds of deals (such as 1000 minutes/month for $X, with some discounted pricing, etc). We are still working on the details and it might not manifest exactly as described here.

    Please note that I do read all of these comments and we're working hard to offer a high-value service that accommodates studios of all sizes.
     
    Last edited: Jun 28, 2023
    jlemosz and saskenergy like this.
  20. Chris_Webb

    Chris_Webb

    Joined:
    Mar 18, 2014
    Posts:
    128
    Hey,

    Thanks a lot for addressing everyone's concerns.

    You mention that this model enables you to "Offer more value". Are you able to expand on this? From my perspective, everyone basically just woke up one day, and a service they had been relying on became prohibitively expensive, with no improvement. Is there a specific type of customer you see who is now getting more value? I work with a really wide range of studio sizes, and no one seems to have benefited from this.

    Indie developers are especially vulnerable to billing fluctuations, and changing from a fixed monthly cost to an indeterminate one (or one that you have to argue with support every now and then when a build fails) is very problematic. I imagine a lot of people might find use in a plan where you can get n successful build per day, for a fixed price. This would address both parties concerns. I understand where you are coming from with consumption based pricing, but paying by the minute sucks for several reasons. It can be seen that Unity has no incentive (actually, they are disincentivized) to improve the already problematic build times. It is also more difficult to predict which is life or death for smaller developers with shoestring budgets.

    To give you two examples which might help you understand the decisions being made here:

    I work on a game with one other person, and used UCB solely for iOS builds, because we did not want to invest (yet) in a mac. UCB was an absolute dream solution for this, and I know many people who used it for exactly this too. With the changes to UCB, it was way cheaper (and more predictable) for me to just buy a mac and make my own build machine. I ended up doing this unfortunately.

    I work for several larger studios (20/30+ people) who do continuous builds on anywhere up to 6 different platforms. It is significantly more economical to buy a beefy local threadripper (or equivalent) which can handle all of these platforms/builds at once, and often many times faster than what is possible with UCB.

    I hope Unity can figure out a middle ground everyone is happy with. I have loved using this service for years, but with the current pricing, I can't see where it fits.
     
    PeachyPixels and Novack like this.
  21. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,001
    *something something* democratize game development *something something*

    (EDIT: I just thought of new marketing mottos for you and I am SO EXCITED, you can have them for free:

    "Democratize evaluation of competitor services!"

    "Democratize finding ways to depend less on services because they will screw you over!" )

    It’s okay, whoever is making these decisions is clearly setting up all the services up for failure. This model change is a mess, Analytics pricing is a mess, the renaming of the otherwise great PlasticSCM is making all non-Unity users get cold feet and start looking for alternatives, ArtEngine is getting turned into a cloud service so that it can fail again, the way you are handling the recently announced AI services is also a mess.

    Clearly there is coordination and a well thought and well executed plan at play here and its purpose is for all these services to die and I for one, applaud you for it.
     
    Last edited: Jun 30, 2023
  22. iagocco

    iagocco

    Joined:
    Feb 3, 2019
    Posts:
    12
    RIP Cloud Build, what they did is so absurd that there's no hope left, even a middle ground would still be absurd.

    With my individual project, I would go from $40 to $1000 per month. It's easier to spend that on setting up my own infrastructure and get rid of the monthly fee.

    1000 minutes per month plans? That's completely ridiculous. Anyone would use that up in a day doing multi-platform test builds.

    They want their customers to be limited to trashy mobile games that can be imported in 20 minutes.

    Unfortunately, I am already migrating to game.ci.
     
  23. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    678
    Hi @wrossmck-unity

    Thanks for the update.

    First off, the positive...

    It sounds like there might be more flexible usage options going forward. But without details or timescales it's obviously not possible to say if these will work (for some\all) or not. But at-least it sounds like some potential progress.

    Now the not so positive...

    I've migrated to DevOps, but mostly to protect the configurations that I spent months setting up and which Unity keep telling me they are about to delete!

    But I'm restructuring my build processes to vastly minimise costs, whilst looking at migrating away (unless the more flexible features you talk of are worthwhile). So Unity will no longer be getting regular income from me, whilst I'm having to waste time investigating\implementing alternative approaches. Which is not ideal for both sides.

    Unity have been continuing to take my monthly TA payment and even though I just migrated to Dev Ops, has not cancelled my TA subscription and there is no way to cancel this in the dashboard. So I logged a support ticket, only to be told there will likely be a 7 day turnaround.

    In the meantime I suspect Unity will take my TA payment yet again and now I'm in a situation where I will have to try and claim that money back somehow. It's a mess and a colossal waste of time, so I hope you can appreciate people's frustrations.

    We all understand costs are going up for goods & services around the world, but the direction Unity have taken UBA is not conducive to retaining loyal customers or winning over new ones, which is a real shame for everyone.
     
  24. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    840
    Has anyone tried Buildkite? There are some articles about using it with Unity. Has a solid free tier for low profile projects (3 users, 5000 montly minutes, 100k montly test runs, 90 days build retention) and the paid tiers are pretty reasonable as well. Was wondering if there was any direct experience from someone here to share.
     
    Last edited: Jun 30, 2023
  25. Shredsauce

    Shredsauce

    Joined:
    Apr 4, 2016
    Posts:
    37
    This was happening to me too. However Unity did reverse the payment and cancel my subscription after logging a support ticket. This was 2 weeks ago though. The fact that Unity knows Teams Advanced payments are still coming in and not doing anything about it is a little concerning. Who doesn't like free money though?
     
  26. wrossmck-unity

    wrossmck-unity

    Unity Technologies

    Joined:
    Nov 9, 2021
    Posts:
    87
    Anyone who has a currently active Teams Advanced subscription will not see any usage in their Unity DevOps invoice for Build Automation, since our service honours the TA subscription and won't forward any usage to the billing system until the TA subscription is inactive/expired/cancelled. Additionally, we did offer the early migration incentive which was 30 days of free Mac standard minutes for folks who migrated early, which applies from the expiry date of the TA sub. We are looking into the specific edge case of TA subs continuing to renew since a few folks have experienced that.

    Regarding competitors, I'd encourage you to look into the details around pricing and the limitations of their services.

    For example we have:
    • built-in unity editor licensing costs
    • unlimited artifact storage/egress
    • no cap on artifact size
    • no cap on history/retention
    • no cap on repository size limit (on Windows, Mac Coming Soon™)
    • large amount of available disk space at build time (depends on machine type)
    • Windows & MacOS buildmachines
    • over 350+ Unity versions supported natively, updated daily
    • specialized hardware for realtime3d workloads
      • super fast NVMe disks
      • high CPU clock speeds
      • benchmarked CPU:Ram ratio
    • fully supported Unity build targets
      • MacOS
      • Windows
      • iOS
      • Android
      • WebGL
      • UWP
    • built-in caching mechanisms
    Admittedly, some of these items drive the costs up, such as super fast SSDs, high CPU clock speeds, and running on a fully fledged Windows/MacOS VM. We have some internal initiatives to avoid those constraints so that we can offer machines types at a lower price point in the future.
     
    jlemosz and saskenergy like this.
  27. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    678
    Hi @wrossmck-unity

    Let me start by saying that I appreciate your hands are likely tied on a lot of this and that you're just trying to help. I also appreciate your feedback and that concerns haven't completely fallen on deaf ears.

    Support cancelled my TA subscription just in-time, so no extra money was taken thankfully.

    Speaking from an indie perspective, that wasn't an incentive. Why would anyone migrate early when they already had considerably more Mac 'minutes' with the TA subscription.

    It literally took the daily dashboard warning from Unity that they were about to delete all my UBA configurations (which took months to setup) to switch. Imagine how that makes one feel about the approach and service.

    Again (speaking from an indie perspective) I care little for most of the items you've listed. Unlimited repo limits, NVMe disks, fast CPU & RAM (etc) are a far lower priority for me.

    My priorities are (a) being able to-do a handful of daily builds for Windows\Android\iOS and (b) doing so for an affordable\consistent cost each month.

    With TA some (higher build) months I would get value for money. Other (lower build) months Unity would get value for money.

    But it was a service that was (a) always within my monthly budget (b) didn't require a masters degree in maths to calculate costs (c) something that didn't require close monitoring and (d) didn't waste my time trying to claw back failed build costs that weren't my fault.

    That would definitely be welcome and a step in the right direction (see above)

    A service that offered unlimited (or N successful builds per day - not build minutes) on slower hardware, with lower repo\storage limits at a consistent monthly cost (you know, like TA ;)) would be warmly received I'm sure...
     
    Last edited: Jul 5, 2023
  28. Chris_Webb

    Chris_Webb

    Joined:
    Mar 18, 2014
    Posts:
    128
    With the price as it is currently, Unity is unfortunately not just competing against other cloud providers, but physical hardware. It would be easy(but naive) for Unity to think "Its hard to set up on premise CI, so its not our competition", but unfortunately your customers are technically literate game developers, and it took me 1 months cloud build cost + one night to set up a service which annihilates the performance and long term price of cloud build. Unity can spend all day talking about high performance builders, fast disks, fast whatever., but the reality is that my 40-50 minute cloud build jobs now take under 3 minutes on my low spec macmini build machine (which can also handle 4+ simultaneously builds). Something is deeply wrong.

    That is an almost unimaginable situation for most cloud services I have used. The equation was never like this. It was never even close to being financially advantageous to buy an entire computer than use this service for a month.

    I also appreciate that your hands must be tied, and that you also understand all of this, but I am just sad, really.
     
  29. newlife

    newlife

    Joined:
    Jan 20, 2010
    Posts:
    990
    That's really a pity, I didn't know about this price change till I receive an invoice from unity of 15$ for just four iOS builds.
    What I really can't understand is how come that people at unity realized that their price model was unsustainable after almost 10 years... It really seems that they are exploiting their de facto monopoly.
    Anyway, which are the alternatives now? I had a look to game.ci and others but seems a pain in the ass to setup.. More, its not clear to me if those alternatives are really able to build on iOS without the need of a Mac.
    @Chris_Webb, it seems that you examined all the unity cloud build alternatives including owning a mac mini build machine, what do you think its the best alternative for a small team that needs unity cloud build only to make iOS builds?
     
  30. Chris_Webb

    Chris_Webb

    Joined:
    Mar 18, 2014
    Posts:
    128
    I would absolutely recommend picking up a cheap m1 mac mini and setting up Jenkins locally. You can make a service which functions similarly, but is also significantly higher performance and much more flexible. The predictable pricing is a massive win for smaller teams too. The obvious issue is the initial up front cost, but you’ll make that back in no time.

    Unity could make cloud build free and we would never go back.
     
    PeachyPixels, Tanek, zzzz789 and 4 others like this.
  31. newlife

    newlife

    Joined:
    Jan 20, 2010
    Posts:
    990
    That's what I was thinking.. I already had a look to used mac mini prices... you can grab one for less than 500$/€

    LOL
     
  32. iagocco

    iagocco

    Joined:
    Feb 3, 2019
    Posts:
    12
    Here, I have configured a Windows machine that compiles for its own system, for Android, and also generates the Xcode project for iOS. The latter is sent to GitHub Actions where it is finalized.
    The total time is much shorter than the Unity Cloud Build.
    To compile on GitHub, I use the following action, which is easy to set up:
    https://github.com/yukiarrr/ios-build-action
    The process in the ci takes about 20min, providing a total of 250 builds for 21 dollars. The free plan offers around 10 builds.
     
    Last edited: Jul 20, 2023
    PeachyPixels and Novack like this.
  33. crekri

    crekri

    Joined:
    Sep 7, 2015
    Posts:
    31
    It took me around 2 weeks to set everything up in Jenkins, and as a Jenkins beginner, it took me quite a lot of trial and error to recreate UCB with Jenkins. Since I am waiting for the build to complete, I figure I could spend some time sharing some of my takeaways that could hopefully save you some time:

    First, follow the tutorial linked by Chris_Webb for a basic understanding of Jenkins.

    1 - How to Setup Scripting Define Symbols
    Use these commands, you can also move UNITY_SCRIPTING_DEFINE_SYMBOLS to a new param or a environment variable
    Code (csharp):
    1.  
    2. sh '''
    3. UNITY_SCRIPTING_DEFINE_SYMBOLS="SYMBOL1;SYMBOL2"
    4. echo $UNITY_SCRIPTING_DEFINE_SYMBOLS | tr ";" "\n" > tmp.txt
    5. while read line; do
    6. echo "-define:$line" >> Assets/csc.rsp
    7. done < tmp.txt
    8. rm tmp.txt
    9. '''
    10.  

    2 - Running Unit Tests and Visualizing Them in Jenkins

    Install the NUnit Plugin and Post Build Task Plugin From Jenkins
    Reference this simplified pipeline
    Code (csharp):
    1. pipeline {
    2.     agent any
    3.     environment {
    4.         UNITY_VERSION = '2021.3.28f1'
    5.     }
    6.     stages {
    7.         stage('Run Tests: Edit Mode')
    8.         {
    9.             steps {
    10.                 //Depending on your jenkins config, you may need to cleanup the workspace so test result and other files won't be left over
    11.                 sh 'git reset --hard'
    12.                 sh 'git clean -fd'
    13.  
    14.                 sh '''
    15.                /Applications/Unity/Hub/Editor/$UNITY_VERSION/Unity.app/Contents/MacOS/Unity -runTests -batchmode -projectPath . -testResults test_results_editmode.xml -testPlatform EditMode
    16.                '''
    17.             }
    18.         }
    19.         stage('Run Tests: Play Mode')
    20.         {
    21.             steps {
    22.                 sh '''
    23.                /Applications/Unity/Hub/Editor/$UNITY_VERSION/Unity.app/Contents/MacOS/Unity -runTests -batchmode -projectPath . -testResults test_results_playmode.xml -testPlatform PlayMode
    24.                '''
    25.             }
    26.         }
    27.     }
    28.     post{
    29.            always{
    30.                 // Convert test results to JUnit format
    31.                 nunit testResultsPattern: 'test_results_editmode.xml'
    32.                 nunit testResultsPattern: 'test_results_playmode.xml'
    33.            }
    34.     }
    35. }
    Add the following

    3 - Fastlane (or other tools) not found when run by Jenkins command, but works in terminal
    Run
    which fastlane
    to find your fastlane's path. Then, in Configure Jenkins > system, add the environment variable name
    PATH+EXTRA
    and put your fastlane's path here.

    * Note that some StackOverflow answers will tell you to add the environment variable name PATH instead and set it to $PATH;your_path_to_fastlane, but this won't work for declarative pipeline

    4 - Passing Extra values from Jenkins to Unity
    Setting up environment variables and reading them in unity is the easiest way, see 2 for how to setup environment variables.

    5 - Git Timeout / LFS Not Pulled
    In git config, add these additional behaviors
    Advanced Clone Behaviours - set Timeout to 60 minutes or more
    Advanced Checkout Behaviours - set Timeout to 60 minutes or more
    Git LFS pull after checkout

    *Protip: You can put checkout as a step in your declarative pipeline so that you don't have to configure it every single time you want to setup a different target. Use "Pipeline Syntax" tool and select checkout to generate corresponding pipeline syntax

    6 - Using and Setting Up Credentials for Keystore etc.
    Pass credentials to unity using jenkins environment variables. E.g.
    Code (csharp):
    1.  
    2. environment {
    3. ANDROID_KEYSTORE_PASSWORD = credentials('ANDROID_KEYSTORE_PASSWORD')
    4. ANDROID_KEY_PASSWORD = credentials('ANDROID_KEY_PASSWORD')
    5. }
    6.  

    For adding credentials, go to Credentials > System > Global Credentials and add the corresponding credentials and ID.

    *Protip: If you have multiple jobs that shares the same set of credentials, put them in the same folder and install the Folders and Credentials Binding plugin to give folder-level credentials.


    7 - Setting Up Provisioning Profile and Uploading to AppStore (Or GooglePlay)
    Follow this tutorial from game.ci. While it uses github action, the underlying concept is the same.


    Conclusion
    Unity Cloud Build is indeed much more convenient to set up and use especially for Unity builds, as Unity does have a lot of quirks which makes setting up Jenkins a lot more time-consuming than I expected initially. if Unity didn't increase the price this much, e.g. to maybe 50-100 USD per month with unlimited builds and fair usage limits, we would probably just prefer to stay now that we know how much effort it takes to set things up. (At our usage UCB goes from 20 USD/month to 1000+ USD/month, though admittedly the previous offer was indeed way too generous and our usage definitely cost them a lot of money).

    If you are someone who isn't experienced with Jenkins and doesn't build too frequently, but have a complicated setup on UCB, depending on how much you value your time, UCB may still be viable for you (let's hope its cheaper tier will roll out soon). At our usage it's just not viable, so we have to migrate, at least I could put Jenkins under my CV now.
     
    Last edited: Aug 3, 2023
    AcidArrow, iagocco, Novack and 2 others like this.
  34. newlife

    newlife

    Joined:
    Jan 20, 2010
    Posts:
    990
    Novack likes this.
  35. newlife

    newlife

    Joined:
    Jan 20, 2010
    Posts:
    990
    Shredsauce, zzzz789 and Novack like this.
  36. Shredsauce

    Shredsauce

    Joined:
    Apr 4, 2016
    Posts:
    37
    Some loser deleted my comment for inappropriate language. I figured an exception was warranted seeing how dumb this whole thing is. I wouldn't be surprised if Unity deleted this entire thread in an attempt to sweep this under the rug.

    Anyway, it doesn't really matter since my Jenkins build machine is still working wonderfully.
     
  37. newlife

    newlife

    Joined:
    Jan 20, 2010
    Posts:
    990
    They deleted also my post regarding the letter from my lawyer. Guess what, the same day my lawyer sent the letter, my account has been unlocked.
     
    Novack likes this.