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. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

Scene Too Large error

Discussion in 'Editor & General Support' started by JamesWjRose, Apr 16, 2018.

  1. JamesWjRose

    JamesWjRose

    Joined:
    Apr 13, 2017
    Posts:
    663
    Hello peoples,

    I have a small scene with about 180 buildings (via Skyscraper Builder) Each of these buildings are created via a script at design time, each building ends up with a folder with the mesh,material and texture. The texture is no larger than 50kb, and the total files size for all buildings is less than 20mb. All was fine until I attempted to open the project yesterday and I got the following message

    Error message:
    "Serialized file size of 4.11 GB (4417480274 bytes) exceeds maximum. File name: E:/Heartbeat City/Heartbeat City/Assets/Heartbeat City/Scenes/HBC.unity. Serialized files over 4.00 GB (4294967295 bytes) cannot be loaded by the player. Some likely ways to reduce this are utilizing asset bundles, re-balancing asset locations, or limiting their serialized size e.g. limiting the maximum texture sizes."

    When I open the project I see the scene in the Hierarchy, but no assets, terrain or anything is accessible. I am running this on Windows 10 64-bit. When I attempted to compile it, just before the error occurred, I set it to compile to x86, not x64.

    This is the second time I have had a scene do this, and it seems that this is a small amount of assets. You can see the file size usage here

    Here is the directory stucture and space usage: https://imgur.com/a/WMVPn

    Also the /Library/Metadata folder has 1.3gb As you can see there is not a lot in this project, atm, so for it to get this issue seems odd.

    Any thoughts?
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    The fact it is a "small amount of assets" doesn't matter, as it is the total size of the scene, not the number of things in a scene, that matters. If it is a small amount of assets, then they must be quite large assets. It also doesn't include just things statically in the scene, but anything you're referencing in the scene for the first time as well.

    If you need it to be that large, you should split your single scene into several scenes you additively load.
     
    JamesWjRose likes this.
  3. JamesWjRose

    JamesWjRose

    Joined:
    Apr 13, 2017
    Posts:
    663
    Thanks for the info. I'd like to ask for some clarification. I get your point about the number of assets matters less than if each asset is large. My follow up is that the total file size for all 180 buildings, textures, meshes, materials and meta files is less than 30MB. This is why I included the directory structure info as well, to hopefully insure I am passing enough info to you, as it FEELS that 30MB shouldn't turn into 4GB. The MetaData folder has a bit over 1 gb, so hopefully you can understand MY confusion, long time developer, recent Unity user, so please pardon my ignorance.

    I posted this last night on Reddit and a user mentioned that I should make these as assets, which is fine I can do that, but I am still boggled that such small numbers expand. I have a few other Unity projects that have much more assets and have not had this problem.

    Thanks kindly for your response.
     
    daviddickball likes this.
  4. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    You've got something using up all that space, but you haven't shown what's in your scene so I can only guess. Again, quantity of assets has exactly zero to do with it. Stop getting hung up on "I have a few other Unity projects that have much more assets and have not had this problem". You could have a million unique assets in a single scene as long as the total size of them all added up is less than 4GB. If you have 2 assets in a scene and they are both 2.1gb each, then you have a problem.

    What is in your Scenes folder that is using up 4.1gb in that image you posted?
     
  5. JamesWjRose

    JamesWjRose

    Joined:
    Apr 13, 2017
    Posts:
    663
    The only thing is the scene folder is the the one scene. I attempted to compile it late Saturday, that's when I got the error message.

    My apologies about the "bigger projects", I only mean to say that the number AND size of the assets in the other projects outweigh this one, as a way to compare. I completely get your point on the NUMBER of assets (1 large asset could easily be bigger than 1000 small ones) I mentioned it because of the size and number in the thought it might be helpful (at least for me) I have been a business software developer for 20 years and have not had to deal with many of these issues, so thank you very much. (really!)
     
  6. OneManBandGames

    OneManBandGames

    Joined:
    Dec 7, 2014
    Posts:
    207
    Does Unity actually store the assets themselves into the .unity scene files though? That would be weird for many reasons.....and also would not add up when I look at the scene filesize in my current project. The scene files are smaller in file size than the assets involved.

    I just have some wild guesses to offer regarding the problem:
    • The script you mentioned went amok at some point and created 1000s of copies of some object (but you probably would have noticed that)
    • afaik objects marked as static are kept as combined meshes in the .scene file, but I can't imagine how that would add up to > 4GB
    • light maps can add to the scene filesize too, but again it would be crazy if you managed to go over 4 GB so easily.
    I would try to reproduce the problem by adding your buildings etc. in a fresh scene. I would hit save after every step and monitor the filesize closely, in the hope you can identify what creates that exponential growth in filesize.
     
  7. JamesWjRose

    JamesWjRose

    Joined:
    Apr 13, 2017
    Posts:
    663
    Update: I found the issue, or at least I believe I found the issue. Each building was to have additional textures for use at random intervals These textures were placed in a LIST<Texture2D> and for reasons I do not know, they were causing the game to balloon in size. I BELIEVE it was because of Baking the lighting. Once I removed these extra textures the game size shunk to 100MB (from 4gb top 8gb)

    Thank you both for the help.
     
    OneManBandGames likes this.
  8. OneManBandGames

    OneManBandGames

    Joined:
    Dec 7, 2014
    Posts:
    207
    Hmm, I have no idea how Unity would handle such a List of Texture2D...since that class allows you to create new textures from scratch, modify their contents etc. I could imagine that those textures were indeed stored inside the scene itself, and not just a reference to a texture asset. If this list was somehow multiplied (1 per building maybe?) It could explain the huge scene size.
    Anyways, 100 MB sounds far more reasonable, glad you figured it out! =)
     
  9. JamesWjRose

    JamesWjRose

    Joined:
    Apr 13, 2017
    Posts:
    663
    You may be right about the textures being stored in the scene, I did one test where each building was a prefab, so I would HOPE that the textures would be stored within that... but I am too ignorant to know if that is true. In any case, with prefabs and with the buildings just in the scene the scene's size ballooned.

    Again, thanks
     
  10. daviddickball

    daviddickball

    Joined:
    May 26, 2014
    Posts:
    10
    Did you ever figure out what caused this scene file bloat? I've recently upgraded an old project from a year ago, and some of the scenes have now bloated from 200k to 200+ MB without making any real changes.
     
  11. Javizuritsson

    Javizuritsson

    Joined:
    Sep 26, 2018
    Posts:
    1
    How did you access your scene file when it got to large to open it in unity? I have the same issue and I would really like to be able to edit my file rather than start all over with building the scene.
     
    Skotrap7 likes this.
  12. Skotrap7

    Skotrap7

    Joined:
    May 24, 2018
    Posts:
    125
    Did you ever figure this out?