Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

PATCH - Updating System

Discussion in 'Assets and Asset Store' started by ManHunterITA, Jul 20, 2015.

  1. ManHunterITA

    ManHunterITA

    Joined:
    Sep 3, 2013
    Posts:
    341
    Well, yeah, it could work by working with different remote URLs, for example. You can select remote URLs based on the account's privileges, without even the need of inventing a custom protocol on top of PATCH versioning.
    For sure it will need some crafting (probably you will need to overwrite some paths to have independent versions of your content) and you will need to customize the sample that comes with the package, but you know: the sample aims for the general case. Special needs => special work needed!

    Let me know how it goes!
     
    BackwoodsGaming and julianr like this.
  2. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    Thanks! You've just given me an idea. I will create multiple scenes that check for updates based on what the user has access to, this way it'll update the core app first, then will launch each scene to update the relevant directories by using different url paths. Each update will still be using the version increments. I'll let you know how it goes.
     
    Last edited: Oct 25, 2020
    BackwoodsGaming and ManHunterITA like this.
  3. Scanlia

    Scanlia

    Joined:
    Apr 13, 2017
    Posts:
    5
    Hi, I was interested in buying this but was unsure about the IL2CPP support. Is it in the works? Kind Regards
     
  4. ManHunterITA

    ManHunterITA

    Joined:
    Sep 3, 2013
    Posts:
    341
    Yeah, it works on IL2CPP. We had two bugs on it but now they have been fixed. And if you eventually get some weird runtime behavior with IL2CPP, just drop me a message and describe what is happening: I'll fix it as soon as possible.
     
  5. kanik155

    kanik155

    Joined:
    Jul 2, 2018
    Posts:
    3
    It doesn't work with il2cpp, it works with mono.
    I get the warning "Updating process failed!"
    Please help me.

    -----
    Unity 2019.4.15f1
    OS:Windows10
    -----
     

    Attached Files:

  6. ManHunterITA

    ManHunterITA

    Joined:
    Sep 3, 2013
    Posts:
    341
    Can you add more about this? Which problem you got with IL2CPP?

    You should add additional logs to help me. Take a look here: https://github.com/manhunterita/PATCH/wiki/Troubleshooting#how-to-ask-for-help
     
  7. kanik155

    kanik155

    Joined:
    Jul 2, 2018
    Posts:
    3
    My build with il2cpp is not updated.
    Attached is a log and screenshot.

    Tested environment
    - macOS Catalina + Unity 2019.4.15f1
    - macOS Catalina + Unity 2018.4.29f1
    - Windows 10 + Unity 2019.4.15f1
    - Windows 10 + Unity 2018.4.29f1

    It's a good tool and I would love to build it in il2cpp as well.
     

    Attached Files:

    ManHunterITA likes this.
  8. ManHunterITA

    ManHunterITA

    Joined:
    Sep 3, 2013
    Posts:
    341
    From logs, seems you have an outdated version of Newtonsoft.Json.dll in your project. Try to update it to the latest version (PATCH uses >= 12.0.0.0).
     
  9. iSleepzZz

    iSleepzZz

    Joined:
    Dec 23, 2012
    Posts:
    206
    Hi there @ManHunterITA , I purchased your Patch updater/Launcher and now am trying to get it all setup.
    I finally got it connecting to the web server because I needed to add the MIME type of .json files being seen and downloadable.
    However, now when I open the launcher, it start to download the game freezes at 1% with the message of "Updating process failed!" and an elapsed time of 00:02.

    Am I missing something somewhere? Any information would help me, thanks!
     

    Attached Files:

    ManHunterITA likes this.
  10. ManHunterITA

    ManHunterITA

    Joined:
    Sep 3, 2013
    Posts:
    341
    Hey, how suggested before, check this page in the Wiki and include all needed log files: https://github.com/manhunterita/PATCH/wiki/Troubleshooting#how-to-ask-for-help

    Anyway, my guess is that a good amount of mime types cannot be served by your web server. By default extensions like .dll, .exe, .pdb and many more are forbidden. And Unity builds are full of those extensions. Check this out.
     
    iSleepzZz likes this.
  11. iSleepzZz

    iSleepzZz

    Joined:
    Dec 23, 2012
    Posts:
    206
    Awwh yes the Player.log had even more detail about what errrors were occuring.
    Got it all working properly now!
    Thanks so much :)


    EDIT: However, under more testing. The game builds work flawlessly, but the Launcher updates seem to not do anything. If I build a new launcher and use the admin tool to compress it and upload the latest launcher into my web server. It will not check the local launcher to the latest launcher and update itself.
    It only is checking game updates.
     
    Last edited: Nov 30, 2020
  12. ManHunterITA

    ManHunterITA

    Joined:
    Sep 3, 2013
    Posts:
    341
    The PreGame scene in your game deals with the Launcher update. It's the reason why it exists! :)
     
  13. iSleepzZz

    iSleepzZz

    Joined:
    Dec 23, 2012
    Posts:
    206
    Awwhhh yes! That makes a lot of sense!
    I was wondering how it could update itself when it's own process is still running haha.
    Okay, thanks! Will definitely be looking through this and getting it to works.
    Thanks alot :)
     
    ManHunterITA likes this.
  14. iSleepzZz

    iSleepzZz

    Joined:
    Dec 23, 2012
    Posts:
    206
    Okay @ManHunterITA , I have everything up an running and it's perfect!
    However, I just have a question.
    While I continuously will be relapsing patches and updates for the game.
    Now my Builds and Patches folder is getting increasingly large now.
    Was wondering how and if I could delete/clean up the files?
    Can I simply delete all other build files unless it's the latest build for the "Builds" folder?
    And what to do with the "Patches" folder as well?
    Thanks so much!
     
    hopeful and ManHunterITA like this.
  15. ManHunterITA

    ManHunterITA

    Joined:
    Sep 3, 2013
    Posts:
    341
    Hey! I proposed a good strategy to manage builds and patches here: https://github.com/manhunterita/PATCH/wiki/Updating-strategies
     
    hopeful likes this.
  16. ManHunterITA

    ManHunterITA

    Joined:
    Sep 3, 2013
    Posts:
    341
    Release 2.4.0 has been submitted on Asset Store. Here is the changelog:


    • feat(Hashing): improved the hashing time by buffering the disk operations
    • fix(Admin): fixed the inverted args parsing for --patch command
    • fix(Repairer): fixed an edge case in the integrity checking
    • fix(IO): improved the Delete method logic and error management
    • fix(SmartDownloader): the downloader is correctly stopped when in Editor Mode
    • fix(Repairer): fixed wrong logic that triggered an InvalidLastWriting every time
    • feat(Launcher): added LaunchAnywayOnError flag to allow the Launcher to start the game anyway if an error occurred
    • fix(Repairer): optimized the GetFileIntegrity method, now it builds a map of LocalFileInfo instead of looping through all of them everytime
    • fix(Launcher): added an initial message when the process start
    • fix(SmartDownloader): limited the amount of downloader threads to a maximum of 8
    • fix(SmartDownloader): removed the useless WebClient instance
    • fix(Hashing): fixed an edge case that prevents empty files to be hashed correctly
    • fix(Launcher): added Working Directory setting before launching the Game
    • update(Downloaders): download speed is now tracker with a IDownloadSpeedMeter component
    • update(FileDownloader): added a retry-based strategy to mitigate the impact of occasional web errors
    • update(FileDownloader): included in the retry-based strategy the GetFileSize request
    • refactor(Downloaders): refactored code for downloaders
    • fix(Launcher): improved error reporting when the update process fails
    • update(Launcher): added TryStartGameAnyway behavior when the update fails
    • update(Launcher): logged the FolderNotWritable error
    • update(NetworkChecker): abstracted the NetworkChecker into INetworkChecker, so it can be used with various Downloaders
    • update(NetworkChecker): a new DropboxNetworkChecker is available
    • fix(Launcher): changed the way the RootPath is computed, to make it compatible with numerous deployment methods
    • feat(Repairer): moved to size-based progress, with the Downloader that can report downloaded chunks size
    • feat(PatcherUpdater): moved to size-based progress
    • feat(Updater): moved to size-based progress
    • fix(PatchBuilder): the TotalSize of PatchDefinition is now correctly populated
    • fix(UpdatingContext): handled an error case where the version file could be corrupted
    • feat(Launcher): shown the computed size and the total size
     
    julianr and hopeful like this.
  17. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    @ManHunterITA - nice update / fixes! This could be the patching solution that everyone uses - keep up the good work.
     
    ManHunterITA and hopeful like this.
  18. FictiveDev

    FictiveDev

    Joined:
    Aug 14, 2019
    Posts:
    6
    I get "Updating process failed" with no clue...
     

    Attached Files:

  19. ManHunterITA

    ManHunterITA

    Joined:
    Sep 3, 2013
    Posts:
    341
    Update to the latest 2.4.1, it contains an hotfix for this problem.
     
  20. vof-t

    vof-t

    Joined:
    Oct 18, 2017
    Posts:
    4
    Is PATCH actually tested on Mac (particularly on macOs Mojave/10.14)? I'm getting this issue (see screenshot) when placing my app into Application folder. No logfiles generated, app will just close even on "Continue". I'm using latest (2.4.1) release. Please help.
     

    Attached Files:

  21. ManHunterITA

    ManHunterITA

    Joined:
    Sep 3, 2013
    Posts:
    341
    It seems like your application has not enough privileges to write in that folder. So PATCH cannot write logs nor game files.
     
  22. ManHunterITA

    ManHunterITA

    Joined:
    Sep 3, 2013
    Posts:
    341
    The 2.4.2 version is out! It contains some fixes and improvements:
    • fix(Progress): workaround for ProgressReporter throwing NullReferenceException
    • fix(SmartDownloaderMetrics): fixed NullReferenceException while counting the workers amount
    • update(Downloaders): removed the deprecated ProgressChanged event
    • fix(Downloaders): fixed an old bug that prevented some files to be saved and introduced some performance improvements
     
    julianr and hopeful like this.
  23. ManHunterITA

    ManHunterITA

    Joined:
    Sep 3, 2013
    Posts:
    341
    The 2.5.2 release is out! Here is a changelog of what happened recently on PATCH!

    = 2.5.0 =
    • fix(Downloader): fixed an error triggered when the web server does not support partial downloading
    • feat(Downloader): exposed IWebProxy property in IDownloader and INetworkChecker
    • fix(LauncherUpdate): added the hash checking when the file size is the same
    • fix(LauncherUpdate): set the dirty flag after the file downloading
    = 2.5.1 =
    • update(Logger): improved the logging mechanism for the whole project
    • update(Files): improved the management of an edge case for IsFileLocked function
    • fix(PatcherUpdater): checking if the temporary file generated when the file is locked does not already exist
    • feat(Launcher): added a way to override needed settings without having to recompile the solution
    • update(LauncherUpdate): removed LastWriting check and added EnsureDefinition everytime to sync Attributes and LastWriting
    • update: added Debug Mode
    • update(Logging): now information on the caller (file, line, method) are only displayed in Debug Mode
    • update: added some additional generic logging through the project
    = 2.5.2 =
    • fix(LauncherUpdate): checking if the temporary file already exists before renaming it
    • fix(LauncherUpdate): removed the last renaming/copying operation before the end of the update process, it seems it is not needed anymore
    • update: removed "sealed" marker from all classes
    • fix(Repairer): fixed the path to delete when file has invalid size
    • update(LauncherUpdate): added Safe Mode with rollback
    • update(LauncherUpdate): added a way to restart a specific executable in Safe Mode
    • update(LauncherUpdate): cleaned up the Safe Mode, added auto-disabling after success, added a way to prevent Safe Mode looping
    • fix(AdminTool): fixed RootPath detection for CLI SingleFile building
     
    julianr likes this.
  24. ManHunterITA

    ManHunterITA

    Joined:
    Sep 3, 2013
    Posts:
    341
    The 2.5.3 release is out!

    = 2.5.3 =
    • fix: ensure the Temp directory creation
    • fix(FilesManager): fixed an issue in the SanitizePath method
     
    julianr likes this.
  25. ManHunterITA

    ManHunterITA

    Joined:
    Sep 3, 2013
    Posts:
    341
  26. RubenHeeren

    RubenHeeren

    Joined:
    Dec 9, 2019
    Posts:
    9
    Hi there. I use the integrated patcher which lives on a separate first launcher scene. But when I update that scene my players can successfully patch their game but it crashes first. When they restart after the game crashes the patch is applied.

    Has it to do with the multithreading? Anything I can do to fix it?
     
  27. ManHunterITA

    ManHunterITA

    Joined:
    Sep 3, 2013
    Posts:
    341
    I'm not sure I understand what is your settings. Let me check if I got what you have:

    - you run your Launcher (that is a separated executable, the only scene it contains is Launcher)
    - your Launcher updates your Game
    - when done, your Launcher runs your Game and closes itself
    - your Game (that is a separated executable) now starts with PreGame scene as first scene
    - if PreGame finds an update for the Launcher, it applies the update and restarts the Launcher
    - if no update is found, PreGame loads your game's scene

    In the end you should have two executables (Launcher and Game), right?

    If that's the case, check the logs from PATCH and from Unity Player to understand what is happening.
    If that's not the case, re-read the docs and set your PATCH properly!

    Best regards,
    Emanuele - MHLab
     
  28. RubenHeeren

    RubenHeeren

    Joined:
    Dec 9, 2019
    Posts:
    9
    Hi Emanuele,

    Thanks a lot for your quick reply.

    No it's one executable. My game has two scenes in total, one for the launcher (where P.A.T.C.H. lives) and one for the actual game:



    When I update the 'Launcher' scene my players can successfully patch their game but it crashes first. When they restart after the game crashes the patch is applied. I don't think it happens if I only update the 'Main' scene but haven't tested that yet.

    Hope this clarifies it.

    Kind regards,
    Ruben H.
     
  29. ManHunterITA

    ManHunterITA

    Joined:
    Sep 3, 2013
    Posts:
    341
    Hi Ruben,

    as I said: that's wrong! That's not the proper way to set PATCH, take a look at the documentation: https://github.com/manhunterita/PATCH/wiki/Getting-Started#how-does-this-updater-work
     
  30. RubenHeeren

    RubenHeeren

    Joined:
    Dec 9, 2019
    Posts:
    9
    ManHunterITA likes this.
  31. RubenHeeren

    RubenHeeren

    Joined:
    Dec 9, 2019
    Posts:
    9
    Ok so I tried to set it up following the User Manual but I'm stuck atm.

    Followed all the steps exactly and it works in my browser:
    https://s3.eu-central-1.amazonaws.com/patch.stratchampions.com/patch/builds_index.json
    https://s3.eu-central-1.amazonaws.com/patch.stratchampions.com/patch/Updater/updater_index.json

    Built and uploaded the initial build to my file host (Amazon S3 Bucket) without a patch.
    Then built and uploaded the launcher to my file host, extracted the .zip your application generates in a test folder on my desktop and I get the following error:


    My LauncherData.cs in the Launcher scene:


    My LauncherData.cs in the PreGame scene:


    :(
     
  32. RubenHeeren

    RubenHeeren

    Joined:
    Dec 9, 2019
    Posts:
    9
    Fixed. For anyone else stuck on this: make sure you have exactly the same folder structure in your remote patch workspace folder as in your local patch workspace folder. So on your webserver create a folder for Builds, Patches and just upload the entire Updater folder.

    Best patching asset I could find, friendly Discord members also.
     
    ManHunterITA likes this.
  33. Mabu257

    Mabu257

    Joined:
    Sep 24, 2020
    Posts:
    2
    Hi,
    I have a problem where the Launcher and the Game are stuck inside a loop.

    1. The Launcher does something quickly, says "Updating process successfull" and starts the Game.
    2. The Game then adds some files, says "Restart needed" and starts the Launcher.
    3. Repeat...

    I don't know what caused this, maybe after I build a new Launcher inside the Updater folder and pushed it to the server.
    I also reimported "Patch"-Package and redid my Git-Repository (where I got my files hosted), but I still get the loop.

    Pls help
    Thank you
     
    ManHunterITA likes this.
  34. ManHunterITA

    ManHunterITA

    Joined:
    Sep 3, 2013
    Posts:
    341
    Hi, this seems to be a common issue while hosting files on GitHub: https://github.com/manhunterita/PATCH/wiki/Hosting#hosting-on-github

    The issue itself seems to be related to Git LFS.
    Consider moving your files on a different host.
     
  35. Mabu257

    Mabu257

    Joined:
    Sep 24, 2020
    Posts:
    2
    Ok thanks for the response.
    I try using another host for my files.

    But the process for updating the Launcher is correct? Just replace the old Launcher with the new one, generate a new archive, push the new Updater folder and the game updates the Launcher, right?
     
  36. ManHunterITA

    ManHunterITA

    Joined:
    Sep 3, 2013
    Posts:
    341
    Correct, as described here: https://github.com/manhunterita/PATCH/wiki/The-Launcher#first-launcher-update
     
  37. ibrahim000

    ibrahim000

    Joined:
    Mar 16, 2017
    Posts:
    6
    Hi,

    I was wondering if I can implement a beta system where only patches which starts for instance with a certain prefix like maybe BETA_ or something get applied to only users who have access or registered to the beta program and volunteered as a test user .

    I believe the logic which fetch and gets the patches from the server side lies in update context so this is where should I modify but this unfortunately this is encrypted as a dll.

    If you have ideas or advices on how to approach that please let me know

    Best Regards,
    ibrahim

    P.S I am not sure that this is where I should post I am really bad at using forms so if it is the wrong place let me know I will remove it
     
    ManHunterITA likes this.
  38. ManHunterITA

    ManHunterITA

    Joined:
    Sep 3, 2013
    Posts:
    341
    Well, if you have no access to the Pro version (that includes the source code), you can simply change the Remote URL programmatically.
    If the user is in the beta program the Remote URL will be http://yourHost/patch/beta, if not the Remote URL will be http://yourHost/patch/live (or whatever you prefer, of course).
    At this point is just matter of uploading builds and patches to the beta or live folders.
     
  39. manuelgoellnitz

    manuelgoellnitz

    Joined:
    Feb 15, 2017
    Posts:
    397
    Hi,

    since this week when we start our app or start the playmode, a command-line window with "c:\Windows\System32\icacls .exe" opens and closes again.
    I managed to pinpoint the source:

    it is this call in the "PrivilegesSetter" class:

    Code (CSharp):
    1.  private static void EnsurePrivilegesWindows(string filePath)
    2.         {
    3.             var processChmod = new Process();
    4.             processChmod.StartInfo.FileName = "ICACLS";
    5.             processChmod.StartInfo.Arguments = "\"" + filePath + "\" /grant \"Users\":M";
    6.             processChmod.Start();
    7.         }
    It seams that system call opens that command line window because it is the only part in the whole app where such a call exists.
    Is there a way to prevent that that opens a window?

    Because it is really annoying since when that window opens, the app window loses the focus and you have to click on the task-bar icon to get it back in front again.
     
    ManHunterITA likes this.
  40. ManHunterITA

    ManHunterITA

    Joined:
    Sep 3, 2013
    Posts:
    341
    Try to add one of the following lines:
    Code (CSharp):
    1.  
    2. processChmod.StartInfo.CreateNoWindow  = true;
    3. processChmod.StartInfo.UseShellExecute = false;
    4. processChmod.StartInfo.WindowStyle     = ProcessWindowStyle.Hidden;
    5.  
     
  41. manuelgoellnitz

    manuelgoellnitz

    Joined:
    Feb 15, 2017
    Posts:
    397
    The last one did the trick, thx.
     
    hopeful and ManHunterITA like this.
  42. CDAfonso

    CDAfonso

    Joined:
    Sep 16, 2019
    Posts:
    26
    Anyone had success hosting the files in an IIS server?
    I'm having troubles while the launcher download some certain file types. I was able to fix for some of them but "aspx" files cannot be downloaded.

    Code (CSharp):
    1. ...DefaultWsdlHelpGenerator.aspx generated an exception. -   at MHLab.Patch.Core.Client.IO.FileDownloader.Download
     
    ManHunterITA likes this.
  43. ManHunterITA

    ManHunterITA

    Joined:
    Sep 3, 2013
    Posts:
    341
    I never tried to host on IIS, to be honest. You should try to see if there is a configuration to disable aspx processing. That's the only idea that comes to my mind.
     
    CDAfonso likes this.
  44. ibrahim000

    ibrahim000

    Joined:
    Mar 16, 2017
    Posts:
    6
    Hi,
    me again the patch system was working fine for a while till some clients started complaining that the launcher goes nonresponsive giving them a black screen on Mac devices and by some I mean a good number of clients perhaps 50 % of them I don't know what is causing the issue I started separating the code doing some tests till I reached out that this command is the culprit "Context.Update();" it is what is causing the issue. I cannot dig in any further because I believe that this belongs to the UpdatingContext class which is encrypted.

    can you please give me an insight of what this function does exactly and if anyone occurred to have the same issue?
    and finally, if you know how to fix it ?

    thanks.
     
    ManHunterITA likes this.
  45. CDAfonso

    CDAfonso

    Joined:
    Sep 16, 2019
    Posts:
    26
    Thanks ManHunter! I switched to a Apache server and everything works fine. Wonderful work!
     
    hopeful and ManHunterITA like this.
  46. ManHunterITA

    ManHunterITA

    Joined:
    Sep 3, 2013
    Posts:
    341
    Well, UpdatingContext.Update() runs the updating process. So, basically, it does the core work. Understanding what's wrong in your case is just impossible with no additional information. You should take a look at the logs, attach them here if they are relevant and even attach the debugger to your build to monitor what's wrong.
     
  47. CDAfonso

    CDAfonso

    Joined:
    Sep 16, 2019
    Posts:
    26
    @ManHunterITA , for some reason the launcher stop updating.
    If i have a 0.4.0 version, for example and upload all the files of the 0.5.0v. When i run the launcher, it says "Update success", but doesn't update to the new version. If i delete Game folder then it updates. Any clue about what it?
     
  48. ManHunterITA

    ManHunterITA

    Joined:
    Sep 3, 2013
    Posts:
    341
    Check the content of your indexes (both for builds and patches): there may be some errors or duplicated entries in the file structure.
     
    CDAfonso likes this.
  49. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    974
    I'm using API Compatibility Level 4.x in my project. Does this mean I can't use PATCH, since it supposedly requires 2.0?

    I was under the impression PATCH could work standalone, but everything in the documentation seems to suggest otherwise. Like you have to build PATCH as part of your game, since PreGame has to be included? ("When you build your Game, you have to include the PreGame scene at index 0".)

    Also tried to get the WPF thing to work but the project has errors when you try to build it. Might be good to make the project work out of the box or at the very least provide instructions how to set it up (pardon me if it exists but I couldn't find any in the docs).

    All the best.
     
  50. ManHunterITA

    ManHunterITA

    Joined:
    Sep 3, 2013
    Posts:
    341
    PATCH is built on .NET Standard 2.0, so it should work correctly on 4.x and Standard 2.0. It does not work on the old .NET Subset 2.0.

    Yeah, it can work standalone with WPF (or other GUI frameworks you may want to use, for example some customers use Avalonia). It's just the Unity integration that has the PreGame scene to be included as part of your game (because of a Unity Player's behavior I cannot workaround).

    When you open the WPF project simply add the two DLLs included in the zip archive as dependencies: it should be enough to make it work. I thought I've added this information in the docs, but I may be wrong: I'm gonna check! EDIT: yeah, this info was missing. I added it: https://github.com/emanzione/PATCH/wiki/The-Launcher#initialization-on-wpf

    For every additional question, feel free to reply here, mail me or join our Discord server!
     
    Last edited: Sep 27, 2021
    SunnySunshine likes this.