Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

HOT RELOAD - Edit Code Without Compiling!

Discussion in 'Assets and Asset Store' started by reese015, Jan 23, 2023.

  1. ChrisIsAwesome

    ChrisIsAwesome

    Joined:
    Mar 18, 2017
    Posts:
    184
    So I updated Unity to 2031.1 and now any change I make to code forces a recompile when entering play mode, even if the hot reload was successful.

    According to the troubleshooting page, this can be due to the Unity version, but am I really forced to use a different version to avoid this? It's a major inconvenience.
     
  2. PencilBow

    PencilBow

    Joined:
    Jun 23, 2017
    Posts:
    141
    Hey everyone!

    We just released version 1.12.7.

    Fixes:
    • Fixed crash in certain circumstances
    • Fixed update button not working if project is open in Visual Studio
     
  3. PencilBow

    PencilBow

    Joined:
    Jun 23, 2017
    Posts:
    141
    Hey, Unity provides Configurable Enter Play Mode options. If it doesn't work for you, feel free to reach out via email/discord to our support team.
     
  4. PencilBow

    PencilBow

    Joined:
    Jun 23, 2017
    Posts:
    141
    Update:

    We have found a potential solution that we are investigating. If this solution works, we will be able to prevent Unity from compiling automatically (even when AutoRefresh is disabled) when entering/exiting play mode .
     
    ChrisIsAwesome likes this.
  5. PencilBow

    PencilBow

    Joined:
    Jun 23, 2017
    Posts:
    141
    Hey Chris,

    I want to clarify the Unity version the issue started happening on when you've upgraded.
    Looks like you've made a typo, did you mean 2021.1 or 2023.1?
     
  6. ChrisIsAwesome

    ChrisIsAwesome

    Joined:
    Mar 18, 2017
    Posts:
    184
    Oh whoops, meant 2023.1. Issue also happens in 2022.3.12f1 (LTS). Using Hot Reload 1.12.7. And to get more specific:
    - Hot reload does work if you're in play mode. If you make a compatible change not in play mode, it doesn't hot reload, and forces a recompile when you enter play mode. So essentially you have to enter play mode twice with each change, once to recompile, then again to actually test it.
    - Unsupported changes don't recompile until entering play mode, even with "Auto recompile unsupported changes" and "recompile immediately" on. "Recompile in play mode" option makes no difference, it will always recompile in play mode regardless.
    - In project settings, I have "enter play mode options" on, but both options within it are disabled. I do this so it enters play mode instantly. Reloading domain does fix the issues, but it wasn't required when I first started using Hot Reload earlier this year, and I would really rather not have to use it, as I do the static resets on my own to speed up enter play mode times.

    The domain reload was not required in 2021.3 with an older version of Hot Reload.
     
    PencilBow likes this.
  7. PencilBow

    PencilBow

    Joined:
    Jun 23, 2017
    Posts:
    141
    Hey everyone!

    We just released version 1.12.8.

    Fixes:
    • Fixed the inability to install Hot Reload when the PC name contains double-byte characters
    • Fixed the inability to use Hot Reload if the project is inside the user directory with double-byte characters
    • Fixed file changes being ignored when editing scripts in Visual Studio in some circumstances
     
    ChrisIsAwesome likes this.
  8. Igotlazy

    Igotlazy

    Joined:
    Jan 15, 2018
    Posts:
    67
    Unfortunately Hot Reload isn't working for me at all, Playmode or not. My Unity version is 2022.3.10f1, and my Hot Reload version is 1.12.8.
    No code change I make is detected, and I have to click the recompile button to have them applied.

    I get the following error when Hot Reload is started.‪‫‌‮
    [HotReload] Watchman process ran into an error. Falling back to built in file watcher.
    System.TimeoutException: RunQueryRaw timed out. args: get-sockname
     
    Last edited: Nov 8, 2023
  9. DTAli

    DTAli

    Joined:
    Jan 22, 2016
    Posts:
    54
    Hey @PencilBow I'm not sure why this is an unsupported change. I've added the new field, stopped play mode, recompiled in unity, and re-entered. and It still tells me its a new field when I change it.

    upload_2023-11-8_12-24-46.png
     
  10. PencilBow

    PencilBow

    Joined:
    Jun 23, 2017
    Posts:
    141
    Hey there, we've seen your message on discord, and replied to your email. Please let us know if the issue got resolved.
     
  11. PencilBow

    PencilBow

    Joined:
    Jun 23, 2017
    Posts:
    141
    Hey Chris, I've DM'd you an experimental package that might solve this issue. Let me know if that worked for you.
     
    ChrisIsAwesome likes this.
  12. PencilBow

    PencilBow

    Joined:
    Jun 23, 2017
    Posts:
    141
    Hey, it seems it's trying to apply patches after recompiling, which should not be the case.

    Could you try the following:

    - recompile in Unity
    - check if file exists under `<project-path>\Library\com.singularitygroup.hotreload\patches.json`

    If the file exists, we would have to help you debug the cause.
     
  13. DTAli

    DTAli

    Joined:
    Jan 22, 2016
    Posts:
    54
    I see the file. But I've restarted Unity since and it hasn't happened yet. Did you want me to post the patches file when it happens again? (I'll have to restart Unity to resume working, won't be able to wait for a response/debug)
     
  14. PencilBow

    PencilBow

    Joined:
    Jun 23, 2017
    Posts:
    141
    The existence of the file after doing full recompiling is the issue. The contents of the file are not so interesting.

    If you get this issue again after recompiling, check if the file is there.
    The most valuable would be to have a way for us to reproduce the issue, if you have clear steps.
     
  15. DTAli

    DTAli

    Joined:
    Jan 22, 2016
    Posts:
    54
    Don't really have steps... I just work throughout the day and things happen :)
     
  16. Igotlazy

    Igotlazy

    Joined:
    Jan 15, 2018
    Posts:
    67
    Hey there, thanks for the quick responses. Gave the asset another try today and decided to do a full redownload just in case. The error is no longer appearing and the asset itself is working properly. Not exactly sure what happened.

    I tried Hot Reload a few months back and while it worked most of the time, it failed frequently enough for me (and didn't provide enough feedback) that I decided to not use it for my projects. The UI is quite a bit better now. I appreciate the warnings it gives, and the ability to force a reload on your own discretion. I'll give it a test this week and see if anything goes wrong.

    I will say though, from what I have used of it, it feels great. I really hope that the ability to add/edit/remove fields and add new classes/structs comes soon. With those two locked down this asset will be golden.
     
    Last edited: Nov 13, 2023
  17. PencilBow

    PencilBow

    Joined:
    Jun 23, 2017
    Posts:
    141
    Hey, thank you for the feedback.
     
  18. PencilBow

    PencilBow

    Joined:
    Jun 23, 2017
    Posts:
    141
    Alright, we will look into what could be causing this issue. Keep us in the loop if you find more details.
     
  19. Igotlazy

    Igotlazy

    Joined:
    Jan 15, 2018
    Posts:
    67
    Just to follow up on this. Feels amazing to make quick edits without exiting play mode or needing to wait for domain reload. I will say though that Visual Studio's debugger does not play nice with Hot Reload. Nothing is crashing or bugging out, but breakpoints pretty much never work while Hot Reload is on. Any suggestions?
     
  20. DTAli

    DTAli

    Joined:
    Jan 22, 2016
    Posts:
    54
    For me they don't always "never work" but it is not a robust experience. Sometimes they don't work at all, have to restart VS and/or Unity and/or HR. Sometimes attaching/re-attaching fixes it. Sometimes certain BPs don't work, but if you put a breakpoint higher up in your callstack it works, then you step in to get to where you want, not ideal. Lot of times the watch window variables just don't update. Some of this stuff isn't related to HR, it's just the general debugging experience with VS/Unity, it's not great. I'm sure you know of this but just in case, make sure your Unity editor is in "debug mode" (that little icon at the bottom right)
     
  21. PencilBow

    PencilBow

    Joined:
    Jun 23, 2017
    Posts:
    141
    Hey, it is a known problem with Visual Studio, and very unfortunately, we've tried our best to implement debugger functionality, but so far, only Rider seems to be compatible with what we're doing.

    We plan to invest more effort into figuring out why Visual Studio debugger doesn't play well with Hot Reload, but it's a more long-term endeavor.
     
  22. Cameo221

    Cameo221

    Joined:
    Aug 2, 2018
    Posts:
    37
    Popping in to say that the asset is wonderful, and I've been using it since February, all the time while using Unity. It's my absolute favourite utility asset :D
     
    PencilBow likes this.
  23. Davidnovarro

    Davidnovarro

    Joined:
    Oct 6, 2015
    Posts:
    22
  24. PencilBow

    PencilBow

    Joined:
    Jun 23, 2017
    Posts:
    141
    Hey there. Thanks for reaching out. Our support team is looking into an issue and will reply to your email shortly.
     
  25. PencilBow

    PencilBow

    Joined:
    Jun 23, 2017
    Posts:
    141
    Just to follow up on my previous response: we have a solution in mind and it's likely that we will prepare a preview version you could try out soon (possibly next week) to verify that the issue is resolved.
     
  26. Davidnovarro

    Davidnovarro

    Joined:
    Oct 6, 2015
    Posts:
    22
    Great, I will be waiting for the solution :)
     
    PencilBow likes this.
  27. Davidnovarro

    Davidnovarro

    Joined:
    Oct 6, 2015
    Posts:
    22
    Hello, I'm still waiting for the fixed version. When will it be ready?
     
  28. PencilBow

    PencilBow

    Joined:
    Jun 23, 2017
    Posts:
    141
    Hey, we are preparing a beta version and will send it to you via email in the next few hours.
     
  29. Davidnovarro

    Davidnovarro

    Joined:
    Oct 6, 2015
    Posts:
    22
    I'm having this annoying issue, the domain reload is disabled in my project. Yet domain reload gets triggered after exiting the play mode. Any idea why? And how to fix it?
     
  30. Davidnovarro

    Davidnovarro

    Joined:
    Oct 6, 2015
    Posts:
    22
    Apparently, the changed scripts are being reimported after I exit the play mode even though the changes do not require the recompile.
    Is that the intended behavior? Is it possible to reimport those scripts only before recompiling?
     
  31. PencilBow

    PencilBow

    Joined:
    Jun 23, 2017
    Posts:
    141
    Hey, one of our team member got back to you on discord, we will send you an experimental fix for this problem.
     
  32. digiwombat

    digiwombat

    Joined:
    Sep 26, 2013
    Posts:
    48
    Howdy. I'm having a fairly annoying problem. This is on version 1.12.8, Unity version is 2022.3.14

    Every time I click on an object in my hierarchy, it seems to be running asset import or something similar. This is stopping me from selecting multiple scenes in the hierarchy entirely and delays selecting objects by about a second each time.


    This doesn't happen when Hot Reload is off. It often starts an Assets Search Index refresh task, so I assume something is happening with that. It is not the Hierarchy 4 plugin conflicting somehow. I've tested with that removed.
     
  33. PencilBow

    PencilBow

    Joined:
    Jun 23, 2017
    Posts:
    141
    Hey there, could you check if disabling "Asset refresh" option fixes the issue?
     

    Attached Files:

  34. digiwombat

    digiwombat

    Joined:
    Sep 26, 2013
    Posts:
    48
    That did it. Will that re-enable Unity's Asset Refresh or will I now need to manually refresh when changing shaders and textures and the like?
     
  35. PencilBow

    PencilBow

    Joined:
    Jun 23, 2017
    Posts:
    141
    Unity's Asset Refresh will not be enabled if the setting is off.
    To make it work we would need to find what triggers file modifications when you select something in the Hierarchy.
    It's quite unusual issue to have, perhaps you have any ideas on what might be triggering it?
     
  36. digiwombat

    digiwombat

    Joined:
    Sep 26, 2013
    Posts:
    48
    Okay! After a bunch of testing, the asset refresh was being triggered by a random Editor Window that was, I guess, calling something when it would redraw. I haven't dug into the code for it yet. Anyway, Hot Reload was helpfully refreshing the assets which led to the deselection.
     
    PencilBow likes this.
  37. Starburst999

    Starburst999

    Joined:
    May 8, 2017
    Posts:
    59
    Seems like it currently doesn't listens for changes for paths in "packages.json", I have a library where I use
    Code (CSharp):
    1. "com.my.library": "file:../../XXXXXX"
    would be nice to have the option to listens to those.
     
  38. PencilBow

    PencilBow

    Joined:
    Jun 23, 2017
    Posts:
    141
    Hey there, thanks for bringing it up. It's a known problem, we'll bump a priority on this issue.
    You can track our progress with this gitlab issue:
    https://gitlab.com/singularitygroup/hot-reload-for-unity/-/issues/221
     
    Starburst999 likes this.
  39. Starburst999

    Starburst999

    Joined:
    May 8, 2017
    Posts:
    59
    Thanks! However I was mislead as it seems my issue had more to do with using a "symlink", it seems like "Hot Reload" does support using the "file:" path in packages (or at least for my use-case seems to work as it should since replacing the symlink with a normal folder instead even if that folder is outside "Assets").
     
  40. PencilBow

    PencilBow

    Joined:
    Jun 23, 2017
    Posts:
    141
    I see. We plan to add support for symlink in the upcoming version. We will look into compatibility of "file:" path for the version afterwards, but there is a chance symlink compatibility will make packages from disk supported as well if they use symlinks under the hood.
     
    Starburst999 likes this.
  41. PencilBow

    PencilBow

    Joined:
    Jun 23, 2017
    Posts:
    141
    Hey everyone!

    We just released version 1.12.9.

    Features:
    • Added support for symbolic links (Junctions)
    Fixes:
    • Provided a solution for Editor recompiling on enter/exit Play Mode
    • Fixed another issue with file changes being ignored when editing scripts in Visual Studio in some circumstances
    Improvements:
    • Added a setting to auto-recompile unsupported changes on exit Play Mode
    • Added a setting to auto-recompile partially unsupported changes
    • Added InvokeOnHotReloadLocal attribute that invokes a patched method
    • Added editor window notifications for hot reload compiling
    • Added experimental support for changing Play Mode Color Tint based on the status of Hot Reload
    • Added a setting to control shader auto-refresh
     
  42. Kurjenpolvi

    Kurjenpolvi

    Joined:
    Nov 15, 2016
    Posts:
    14
    Heya! Does this Hot Reload asset support IL2CPP?
     
    Keepabee likes this.
  43. PencilBow

    PencilBow

    Joined:
    Jun 23, 2017
    Posts:
    141
    Hey there. Hot Reload doesn't support patching On-Device IL2CPP builds, but it works in the Editor even if the build target of your project is IL2CPP.

    Adding support for IL2CPP is possible, and we have it on our roadmap, but it is still far away from being part of the public release.
     
    Kurjenpolvi and Keepabee like this.
  44. Kurjenpolvi

    Kurjenpolvi

    Joined:
    Nov 15, 2016
    Posts:
    14
    Awesome! Thank you for the answer! :)
     
  45. patrick750

    patrick750

    Joined:
    Nov 29, 2019
    Posts:
    14
    Getting a lot of the following error since the newest version (using 2022.3.14f1)
     

    Attached Files:

  46. PencilBow

    PencilBow

    Joined:
    Jun 23, 2017
    Posts:
    141
    Hey, quick diff for the last version doesn't yield hints on where the issue got introduced.
    What was the previous version you've used?
    Could you downgrade to see if the issue is fixed?
    Let us know if we need to send you a previous version package.
     
  47. patrick750

    patrick750

    Joined:
    Nov 29, 2019
    Posts:
    14
    Hey, it stopped happening after a unity restart. Not sure what introduced it in the first place; i was just messing around with animations when it started. I'll let you know if it happens again.

    Also, on a more random note, is support for adding monobehavior methods still something that is being worked on?
     
    Last edited: Dec 21, 2023
  48. PencilBow

    PencilBow

    Joined:
    Jun 23, 2017
    Posts:
    141
    Hey, glad that the issue got resolved. I suspect this to be a very rare issue, and you were unlucky to run into it. If we happen to gather more information about it, we will fix it and let you know.

    Hot Reload fully supports adding monobehaviour methods in code. The only limitation is that they don't show in the inspector. We don't have a solution to this issue yet, and if you have any insight on how we could support it, we will be glad to listen.
     
  49. Gronade

    Gronade

    Joined:
    Feb 14, 2020
    Posts:
    19
    I bought it but I'm not sure how to activate it in Unity. I was using the trial prior to purchasing it.
     
  50. PencilBow

    PencilBow

    Joined:
    Jun 23, 2017
    Posts:
    141
    Hey there, sorry for the inconvenience. We will follow up in a reply to your email.