Forum Discussion

Titangen's avatar
Titangen
Member
2 months ago
Solved

Desktop editor creates .tmp files instead of updating script

I have stumbled into an issue i dont have an easy fix for, i usually got around it by cloning the world, but i think there needs to be a better, more consistent solution. the issue im talking about is once in a blue moon my desktop editor starts freaking out and instead of updating the same script im making edits to, it creates .tmp files out of updated version and reverts the original file to old version. how do i fix or bypass that bug. ive tried deleting the tmp, deleting the original and saving the tmp as original file, but i want to get to the bottom of the issue. 

  • I've run into this exact issue many times, and it's incredibly frustrating. I believe your experience is directly linked to the VScode-to-editor compilation process, and I think I know what's happening.

    What I Believe is Happening:

    My theory is that this .tmp file bug occurs when there's a race condition between VScode and the Horizon Worlds editor. If you save a script in VScode, the editor immediately starts compiling it. If you then make another change and save again before that initial compilation is finished, the system gets confused. It can't overwrite the script that's currently "in use," so it creates a .tmp file for your new changes and often reverts the original file back to its last known good state.

    My Current Workaround:

    I've developed a manual, but reliable, process to fix this when it happens:

    1. Don't Touch the .tmp file yet. Go back to the main Horizon Worlds editor.
    2. In the editor's top menu bar, go to Script > Recompile All Scripts. Wait for this process to complete fully. This ensures the editor is in a stable, non-compiling state.
    3. Now, go back to VScode. In the file explorer panel on the left, right-click on the .tmp file and select "Reveal in File Explorer" (or "Show in Finder" on Mac).
    4. Delete the .tmp dile
    5. Return to the Horizon editor. Add your changes, save, it should now detect the "new" script correctly and compile it successfully. If not then manually compile that single script.

    It's certainly a long-winded process for 2025, and it adds significant friction to the development loop. However, it has been a consistent way for me to recover my work without losing changes. The key seems to be getting the editor back to a stable state before manipulating the files.

    Hopefully, this helps you and others get un-stuck, and hopefully, the underlying sync issue can be addressed soon.

5 Replies

  • I've run into this exact issue many times, and it's incredibly frustrating. I believe your experience is directly linked to the VScode-to-editor compilation process, and I think I know what's happening.

    What I Believe is Happening:

    My theory is that this .tmp file bug occurs when there's a race condition between VScode and the Horizon Worlds editor. If you save a script in VScode, the editor immediately starts compiling it. If you then make another change and save again before that initial compilation is finished, the system gets confused. It can't overwrite the script that's currently "in use," so it creates a .tmp file for your new changes and often reverts the original file back to its last known good state.

    My Current Workaround:

    I've developed a manual, but reliable, process to fix this when it happens:

    1. Don't Touch the .tmp file yet. Go back to the main Horizon Worlds editor.
    2. In the editor's top menu bar, go to Script > Recompile All Scripts. Wait for this process to complete fully. This ensures the editor is in a stable, non-compiling state.
    3. Now, go back to VScode. In the file explorer panel on the left, right-click on the .tmp file and select "Reveal in File Explorer" (or "Show in Finder" on Mac).
    4. Delete the .tmp dile
    5. Return to the Horizon editor. Add your changes, save, it should now detect the "new" script correctly and compile it successfully. If not then manually compile that single script.

    It's certainly a long-winded process for 2025, and it adds significant friction to the development loop. However, it has been a consistent way for me to recover my work without losing changes. The key seems to be getting the editor back to a stable state before manipulating the files.

    Hopefully, this helps you and others get un-stuck, and hopefully, the underlying sync issue can be addressed soon.

  • I hope that turns out to be your problem and solves the issue for you. I only use one account so it cannot explain why the desktop editor often fails to update my scripts.

    • Titangen's avatar
      Titangen
      Member

      Nope. Still having this issue, dont know why it worked for a while and now again it doesnt... My laptop didnt go to sleep, nor i changed anything but now were back to the TMP issue again...

  • I often see this issue. The suggested solution is to copy the tmp file contents, delete the tmp file and reupdate the script file with the tmp contents. But that often just creates a new tmp file.

    The most reliable solution I have is restarting the editor but even that does not always solve the problem. I don't understand why the problem occurs but it has wasted a lot of my time.

    • Titangen's avatar
      Titangen
      Member

      I think i stumbled into the root problem and into the solution. i was logged in under another account in the forums, since we have several pairs of glasses in our university. And i think desktop editor uses the logged account to sync updates and thus failed. Now since i logged back in through the same account through what i was creating the world, it syncs and updates the script iteration! 
      TLDR: make sure you are logged in via browser to same account as in desktop editor for it to sync correctly.
      PS: can any more experienced/ mods/ staff confirm is my theory valid or not?