Search Unity

Some assets are giving an "invalid serialized file header" error

Discussion in 'Editor & General Support' started by ilusomu, May 28, 2015.

  1. ilusomu

    ilusomu

    Joined:
    May 28, 2015
    Posts:
    24
    Hey folks! I'm part of a 5 person team working on a game project and each of us owns a copy of Unity 5 Pro. We're using Perforce integration for source control and have had several assets (like the Tag Manager and some prefabs) give us the following error: "Invalid serialized file header." We can't identify what exactly the problem is and unfortunately there isn't much discussion about it online anywhere. Recently, we changed our asset serialization mode from "Force Text" to "Mixed", but we don't know if that's causing the issue
     
  2. ilusomu

    ilusomu

    Joined:
    May 28, 2015
    Posts:
    24
    Bump! Can't find anyone else having this problem on the net either.
     
  3. BillDCat

    BillDCat

    Joined:
    Sep 6, 2013
    Posts:
    1
    I encountered the same error relating to the meta and mat files. After some experimenting I believe the issue is related to the file types being set to text for the meta files (and maybe for the material .mat files). This might be tied to the versioning settings "Asset Serialization" option as well (although I haven't had time to experiment with modifying that and submitting new files). The meta files being text should be fine, but it seems my P4 server is modifying the end of line (I believe it's a P4 admin setting you can change to support different OS files). In any case, as a work around, I modified my P4 server to recognize both of these file types as binary using the "p4 typedef" admin command and editing the displayed file with the following:

    TypeMap:
    binary //....mat
    binary //....meta

    This only fixes new submissions. To fix current ones I first made sure my default change list was empty. I then went through the project and used the command line:

    p4 edit -t binary "//depot/<project name>/Assets/.../*.meta"
    p4 edit -t binary "//depot/<project name>/Assets/.../*.mat"

    This creates file type changes for all of the .meta and .mat files in your Assets subfolders. At this point I submitted the default change list and synchronized the other machines and it loaded properly without the errors.

    I won't guarantee this resolves the issue for you, but hopefully this helps you out or at least gives you a path to start looking further along.
     
    RG_Keith likes this.
  4. ilusomu

    ilusomu

    Joined:
    May 28, 2015
    Posts:
    24
    Hey folks, just wanted to say that it looks like @BillDCat's solution worked. We aren't running into that problem anymore.
     
  5. ava_fly

    ava_fly

    Joined:
    Jul 1, 2015
    Posts:
    1
    Thanks@BillDCat ,it's useful!

    But as a new to p4v,I encountered two problems. When I using "p4 typedef" admin command,it said "Unknow Command",so i see help and find the command is "p4 typemap".
     
  6. chrisvarnsverryvirtualarts

    chrisvarnsverryvirtualarts

    Joined:
    May 18, 2017
    Posts:
    3
    Thanks guys, very helpful
     
    chaudharyhamza likes this.
  7. chaudharyhamza

    chaudharyhamza

    Joined:
    Dec 12, 2017
    Posts:
    3
    do you find any solutions??
     
  8. chrisvarnsverryvirtualarts

    chrisvarnsverryvirtualarts

    Joined:
    May 18, 2017
    Posts:
    3
    Yeah either change the filetype in perforce to binary, or change your asset serialisation to text, either way works.
     
  9. LZKLNG

    LZKLNG

    Joined:
    Oct 1, 2017
    Posts:
    6
    Hey, I'm getting a similar issue. But I'm getting it for a scene in my Asset folder. Any information on this?
     
  10. mutp

    mutp

    Joined:
    Oct 1, 2018
    Posts:
    79
    Getting the same error as well. Tried @BillDCat solution, but it didn't work.
     
  11. Sompol_Rznet

    Sompol_Rznet

    Joined:
    Sep 14, 2018
    Posts:
    22
    In my case is LightingData.asset

    Let's try to change your .gitattributes file setting. To treat that file as binary file.
    That could solve the problem for me.
     
  12. CiberX15

    CiberX15

    Joined:
    Jul 31, 2013
    Posts:
    15
    Just an update that this is in fact still a thing and BillDCats solution is in fact still the fix.

    If you are using the Perforce Visual client, you can implement the fix by selecting the file that is incorrectly marked as a text file, on the machine where it is working correctly, and checking it out. Once checked out you can right click it and select Change Filetype there should be a drop down near the top of that window that allows you to pick "binary" Then just submit the changes. Once you pull on the remote machine it should be all fixed.

    fwiw this doesn't seem to happen all the time. Only to certain files. I have been successfully syncing material files for years now, but for some reason the material files that came from a package I got on the asset store were automatically synced as text files.