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. We’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

[DOTS] How to fix: "Globalgamemanagers.assets is corrupted" in standalone build

Discussion in 'UI Toolkit' started by Kmsxkuse, Jan 2, 2021.

  1. Kmsxkuse


    Feb 15, 2019
    As mentioned in this thread:

    it appears that the serialization of assets into Globalgamemanagers.assets has bugged out again for standalone Mono and IL2CPP builds.

    It has been previously fixed as seen in this thread

    But once again UI Toolkit breaks the build by merely existing in the packages list.

    My package list is simple, just UIToolkit and HDRP (and the IDE connection).
    Code (CSharp):
    1. {
    2.   "dependencies": {
    3.     "com.unity.ide.rider": "3.0.3",
    4.     "com.unity.ui": "1.0.0-preview.13",
    5.     "com.unity.render-pipelines.high-definition": "10.2.2",
    6.     "com.unity.modules.animation": "1.0.0",
    7.     "com.unity.modules.imageconversion": "1.0.0",
    8.     "com.unity.modules.physics": "1.0.0",
    9.     "": "1.0.0"
    10.   }
    11. }
    Create a new project in 2020.2.1F1 using this list. Build the SampleScene (and it will succeed).

    Immediately crashes with : The file 'C:/.../Game/Game_Data/globalgamemanagers.assets' is corrupted! Remove it and launch unity again!
    [Position out of bounds!]

    Remove UIToolkit and the scene builds and runs with no issues.

    Strangest thing is that it was working earlier today. Midway through my prototyping, it stopped working.

    No updates, no changes to packages, only a scripting change, and routine build check.

    Edit: Right, I think I know what's going on.

    UIToolkit and Entities do not like each other. Not counting the UIElementsModule errors, I've been compiling my project fine before with that error, but something changes when restarting the editor.

    Steps to reproduce:

    1. Make a new 3D project in 2020.2.1f1.

    2. Delete the entire packages Manifest.json folder and replace it with the one above.

    3. Build the sample scene (camera and directional light).
    This works without any crashes.

    4. Add com.unity.entities to the packages list (using add git link).

    5. Build the sample scene again (without changing anything).
    Notice that the player does not crash. In fact, if you were to add UI elements and DOTS components without restarting the editor, the build comes out perfectly with both functioning.
    Doing the same but in reverse, new project with Entities and HDRP -> open editor -> build success -> add UIToolkit -> build success, also works.

    6. Restart the editor.

    7. Build the sample scene again.
    Notice that the player crashes with this error.

    8. Remove the Entities (or UIToolkit) package without restarting the editor.

    9. Build the sample scene again.
    Notice that the player crashes with the same error.

    10. Restart the Unity editor.

    11. Build the sample scene again.
    Player does not crash.

    Conclusion: Importing Entities and UIToolkit breaks compatibility but not when UIToolkit is newly added during an already existing Entities project. That implies that importing Entities first then UIToolkit or UIToolkit and then Entities results in a functioning build but not at the same time.

    Note: I have not tried this with Hybrid Renderer. Only Entities.

    In order to reset the editor to be able to build successfully again with both, you will need to remove either Entities and UIToolkit, restart the editor, then re-add the removed package and continue working.

    So long as you do not close the editor, the build functions with both UIToolkit and Entities. An annoying requirement but you can at least continue working.

    Before closing the editor, remove either Entities or UIToolkit (I recommend UIToolkit as it's faster to reimport). If you remove UIToolkit, the packages window and some parts of the editor will break. Ignore it and just close the editor.

    Reopening the editor, you will recieve a "enter safe mode" prompt. Ignore it and continue on.

    Re-add "com.unity.ui". Wait for to finish importing. Clear the console of all the errors and no script should be outputting an error now that both packages UIToolkit and Entities are added.

    If the packages window is still broken, open up Manifest.json with the editor still open and manually add in
    "com.unity.ui": "1.0.0-preview.13",
    to the list. Then tab back to the Editor and it should start the import process.

    Start the editor's player at least once.
    There will be a lot of warnings and a few errors in the console but ignore them. That's just UIToolkit actually being recognized by the editor. If you do not do this, then the build will "succeed" but with a lot of errors about missing UI shaders and whatnot.

    While you're in the editor player mode, check to make sure all the UI elements are operating properly and the various runtime components are functioning post reimport.

    Then build the project, both should be functional. Entities should be working and the UI should be there.

    Simple and easy workaround. Well, simple and easy in the standard of Unity DOTS workflow. If you're working with Entities, this level of workaround should be standard practice by now.
    Last edited: Jan 2, 2021
  2. nichayes


    Dec 21, 2020
    Confirmed I was able to reproduce this in my project with 2020.2.1f1 and UI Toolkit... back to 2020.2.0f1...
    Kmsxkuse likes this.
  3. Kmsxkuse


    Feb 15, 2019
    I've also reproduced this in 2020.2.0f1 so downgrading unfortunately doesnt help if that's what you're suggesting.

    At least the in-editor player works. These hoops must only be jumpped through when building a new standalone.
  4. LeonhardP


    Unity Technologies

    Jul 4, 2016
    Could you please submit a bug report with a reproducible attached if you are seeing these issues in 2020.2.1+?
  5. StefanWo


    May 24, 2015
    It seems its the same thing that happens now in 2022.2.0f1. The workaround seems partialy working, sometimes it needs a second try to make it work. This time it say:
    Code (CSharp):
    1. Asset has disappeared while building player to 'globalgamemanagers.assets' - path '', instancedID '-43676'
    Can it be related? Any updates to this bug?