Search Unity

Unknown error occurred while loading 'Scene Name'.

Discussion in 'Editor & General Support' started by bytterfly-com, Aug 20, 2015.

Thread Status:
Not open for further replies.
  1. Rallix

    Rallix

    Joined:
    Mar 17, 2016
    Posts:
    139
    Looks like using backup – at least in some cases – is the root of the problem. At least according to this and this.
    I now keep getting the "unknown error" while trying to use TerrainData which didn't happen until I pushed it with Git LFS and switched to a different branch. Even downloading a month old backup results in the same error because Git LFS with the standard Unity gitattributes defaults to treating *.asset files as text (and converts line endings), but TerrainData is binary even with Force Text option.

    *Sigh*
    'Unknown error occurred while loading 'Assets/Levels/Village Terrain.asset'
    'Invalid serialized file header. File: "Assets/Levels/Village Terrain.asset'

    It is quite frustrating to lose days of work because you're trying to make a backup. If I didn't, I wouldn't have lost it.
     
    Last edited: Sep 2, 2020
  2. paskal007r

    paskal007r

    Joined:
    Sep 6, 2013
    Posts:
    68
    +1 got a solid repro on lfs VS .asset being the culprit here
    This is really something that unity should AT LEAST issue numerous warnings.
     
  3. TextusGames

    TextusGames

    Joined:
    Dec 8, 2016
    Posts:
    429
    Use Git it back ups only changed files. Do not rely only on unity.
     
  4. zemeryj

    zemeryj

    Joined:
    Oct 7, 2020
    Posts:
    6
    Same issue in 2020.1.7f1. Zero Unity acknowledgement or support for a problem that is 5 yrs old this is terrible Unity
     
  5. FabioPDJ

    FabioPDJ

    Joined:
    Jul 26, 2018
    Posts:
    5
    19-11-2020
    unity 2020.1.2f1
     

    Attached Files:

  6. Pdpalma

    Pdpalma

    Joined:
    Aug 14, 2014
    Posts:
    13
    Can't find the "Edit Unity scene file" option with right click. Some screenshot about?
     
  7. pramadanuadhikesumabrawijaya

    pramadanuadhikesumabrawijaya

    Joined:
    Jun 3, 2020
    Posts:
    1
    Hey can someone help me my project almost done when im loading my project scene. Unkow error occured when loading scene:(:(:(
     
  8. bzonca

    bzonca

    Joined:
    Feb 28, 2014
    Posts:
    11
    Can confirm it's due to git LFS, or at least git LFS with scenes that contain terrains. I've gotten the error multiple times throughout the past year. This last one was due to
    git stash
    . Ironically, trying to be safe and save my work is the command that ends up corrupting it. Pretty ridiculous that in 2021, version control isn't something that's streamlined by default at this point.

    The underlying problem is that git is modifying line endings in binary files because it treats them as text files.

    .asset files may either be text or binary. Most are text, but Terrains are binary.

    The reason this happened to me (and perhaps others as well) is because the .gitattributes that I started the project with was from this repo which forces the line endings of .assets (and others) to be modified to LF (a type of line break convention). This is fine in most cases after you set asset serialization to force text, however terrain files remain in binary by design. This means that during certain git operations, git will try to shove in line endings to the binary terrain file which corrupts it. Because the terrain exists in my scene, it ends up corrupting the whole scene. At least this is my theory. The solution seems to be changing the .gitattributes file to not update the line endings, or make an exception for terrain asset files.
     
    Last edited: Mar 9, 2021
    LucasSupportSquare likes this.
  9. buddikanuwan

    buddikanuwan

    Joined:
    Dec 31, 2020
    Posts:
    3
    I have the same issue ...worked for months on my scene but when saving it power goes down ..when starting again nothing left.....
     
  10. SocketByte

    SocketByte

    Joined:
    Aug 14, 2016
    Posts:
    114
    Happened to me as well, but in my case my .unity scene file got actually corrupted, nothing will help because there's no data at all. The file is just bunch of NUL's (U+0000). I had a backup but this seems really bad for a production release. I'm using 2021.1.12f1.
     
  11. AnimalMan

    AnimalMan

    Joined:
    Apr 1, 2018
    Posts:
    1,164
    Problem exists 2022.

    no terrains used.

    had saved project and scene last time I was on as normal.

    wake my computer from sleep, it had shut itself down.

    now scene corrupt.

    luckily was designed in such a way as wasn’t depending on the scene file.

    the scene had 3 objects in its hierarchy

    Two sprite, a main camera. My inspector had one script. Script contained


    A Vector2
    A game object reference
    A list of 9 transforms
    A list of 9 strings
    A list of 9 sprites
    A transform reference
    6 lists of integers
    10 standalone integers
    1 float
    16 stand alone sprite references
    And a color

    Luckily most content is filled via script. But I had to recreate my hierarchy reference. Which was 3 objectsz and refill my sprite lists and string lists. And input all my data but luckily I remember what it all was.


    Oh


    I use an offline machine so it has nothing to do with internet connection.


    my scene tab was closed before and remain closed after the data event.


    After recreating the scene I receive stack error:
    Unknown error LIBRARY/ Current Maximize Layout.dwlt when clicking to maximize screen so I am guessing the scene isn’t the only thing that’s corrupt after such event
     
    Last edited: Feb 20, 2022
  12. Bobxan

    Bobxan

    Joined:
    Nov 11, 2018
    Posts:
    1
    unity 2020.3.21f1

    Unknown error occurred while loading 'Assets/Scenes/Level11.unity'.

    In my case, I normaly worked on this scene, and unity crashes. Often its happen, so what. If I open my project again, I have this error... I does not nothing bad, its just about cresh before.. Many, many hours searching thru internet read hundreds sides , and many many people searching for same solution too... Over years...I try everything, but the last thing I read here and try, is open the file in notepad, and sure, its empty. Other scenes is full of text...................................................... It was many days of work, and its just gone!! without reason. I have the file, I dont erase it, i dont lose pc power, nothing, itrs gone... for sure, i have some backup, but i really CANT make it every day, its idiot idea.. Just unity erase my work :) for no reaseon
     
  13. Vincent454

    Vincent454

    Joined:
    Oct 26, 2014
    Posts:
    167
    I cant believe this, my pc crashed and now my entire scene is gone. The last backup was a few days ago and I have made many very huge changes since. Not all of that is literally gone forever. How does that even happen, it just overwrote the file with nulls, the scene wasnt being saved when it crashed or anything.
    ITS GONE. UNITY. WHY. HOW. WHATTT
     
  14. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,689
    I'm sorry you've had this issue. It's always frustrating to lose work.

    Please consider using proper industrial-grade enterprise-qualified source control in order to guard and protect your hard-earned work.

    Personally I use git (completely outside of Unity) because it is free and there are tons of tutorials out there to help you set it up as well as free places to host your repo (BitBucket, Github, Gitlab, etc.).

    You can also push git repositories to other drives: thumb drives, USB drives, network drives, etc., effectively putting a complete copy of the repository there.

    As far as configuring Unity to play nice with git, keep this in mind:

    https://forum.unity.com/threads/prefab-links-keep-getting-dumped-on-git-pull.646600/#post-7142306

    Here's how I use git in one of my games, Jetpack Kurt:

    https://forum.unity.com/threads/2-steps-backwards.965048/#post-6282497

    Using fine-grained source control as you work to refine your engineering:

    https://forum.unity.com/threads/whe...grammer-example-in-text.1048739/#post-6783740

    Share/Sharing source code between projects:

    https://forum.unity.com/threads/your-techniques-to-share-code-between-projects.575959/#post-3835837

    Setting up an appropriate .gitignore file for Unity3D:

    https://forum.unity.com/threads/removing-il2cpp_cache-from-project.1084607/#post-6997067

    Generally setting Unity up (includes above .gitignore concepts):

    https://thoughtbot.com/blog/how-to-git-with-unity

    It is only simple economics that you must expend as much effort into backing it up as you feel the work is worth in the first place.

    "Use source control or you will be really sad sooner or later." - StarManta on the Unity3D forum boards
     
    Vincent454 likes this.
  15. Vincent454

    Vincent454

    Joined:
    Oct 26, 2014
    Posts:
    167
    Thanks a lot for the detailed writeup! I will definitely use this from now on
    The saddest/funniest thing is this happened literally 1 day before I wanted to put the things from that scene into seperate prefabs ;__;


    If somebody has the same problem: I (to some extend sucessfully) used the program Recuva as recommended in this tutorial: https://superuser.com/questions/377904/recover-file-corrupted-due-to-power-cut-off

    It showed me 2 versions of the scene, 1 was corrupted and 1 was somewhat still working. When imported into Unity, there were 180 errors saying there are duplicate identifiers. I had to go in and for 2 hours remove them from the scene opened in a text editor (Copy paste the number it tells you into the search, then remove one of the two identical parts in that document that start with "--- !u!").

    Even after that it did not recover it fully, but there were about 25-35% of the objects from that scene left.
    Maybe this helps someone, at least as a base for starting over again or combining it with an old backup they hopefully have made ;_;
     
  16. Rallix

    Rallix

    Joined:
    Mar 17, 2016
    Posts:
    139
    .gitattributes
    , too – and very cautiously, if you use Git LFS. I lost work because I was using source control. Even with Force Text, not everything is text (namely TerrainData and LightingData). Losing all your terrains because you switch the branch, unsure what even happened or how to prevent it, was not a pleasant experience.
     
  17. malithgimhanawithanage

    malithgimhanawithanage

    Joined:
    Nov 13, 2018
    Posts:
    19
    HERE IS THE SOLUTION!
    This should work for many of you. https://superuser.com/questions/377904/recover-file-corrupted-due-to-power-cut-off
    Try this method in this forum. Use this software and,

    Type *.unity| in the "Filename or Path" box (instead of *.txt|)

    Then you can find your currupted scene file and right click on it and recover it. Save it to the original location. (Don't save to a new location. It doesn't work) And then Open the scene in unity. You will get at least half of your project files.
     
    Vincent454 likes this.
  18. duhnando

    duhnando

    Joined:
    Jun 21, 2018
    Posts:
    1
    Hi guys, I had the same problem
    I'm using Unity 2020.3.30f1
    In my case, I had a problem with the Terrain Data file, clicking with the right mouse button and clicking on "Show in Explorer", it will have the terrain name ".asset", in the project it was 13.011KB, while in my co-worker's project with 13.008 KB, I then sent the terrain data file separately and my co-worker just had to paste it into the project and it solved.
     
    Vincent454 likes this.
  19. iustinftw

    iustinftw

    Joined:
    Apr 13, 2021
    Posts:
    1
    Now, how tf am i supposed to recover my scene back, i just got a new folder created named sampleScene and in there is a navmesh, if this cant be solved, bye unity, welcome unrealengine
     
  20. VS_Phantom

    VS_Phantom

    Joined:
    Apr 8, 2022
    Posts:
    2
    unity version 2022 and this problem still occurs ;) I know I should keep backups of my projects, although that has nothing to do with the fact that unity hasn't solved this for the past 7 years. Im switching engines asap
     
  21. bitfreaks

    bitfreaks

    Joined:
    Oct 4, 2021
    Posts:
    1
    Known problem for 5 years? Went to sleep last night, suspended my PC. Woke up - and was welcomed with a ruined scene out of nowhere?

    48 hours of work gone... Just wow...
     
  22. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,051
    Files get corrupted. To avoid this, a) stop using a computer or b) use version control.
     
Thread Status:
Not open for further replies.