Could not extract GUID in text file *.unity at line #

Unity Version - 2017.3.0f3

I’m having some trouble with this error constantly popping up. Every thread I’ve read involving this error has to do with .projectsettings, but for me this error is linked to a scene file.

After opening the scene file in text format and finding the lines (it’ll throw me around 11 errors, each a different line, sometimes more) in question, they appear like so:

- {fileID: 2, guid: 00000000000000000000000000000000, type: 0}

When deleting something in the scene, the error appears to disappear, but will eventually return. I tried Reimporting Assets, which made the error disappear again for a little longer than the deleting method, but again it just reappeared.

This error prevents me from building my game, so I can’t ignore it. I’ve already submitted a bug report as well but no reply on the matter just yet.

Hello, I’m having the same problem! Did you figure it out? @Lightrail

I experience the GUID errors as well (working with Unity version 2018.3.6f1). Could only temporary solve the problem and I could narrow down what causes the error and thought I share what I found out so far.

I created a minimal example in a test scene to reliable reproduce the error. The error says (in my case):

Could not extract GUID in text file Assets/Scenes/Test.unity at line 234.
UnityEditor.EditorApplication:Internal_CallGlobalEventHandler()

I found out that the problem in my case is the interaction between a prefab gameobject called SpriteAtlasTest that has the following components: a sprite renderer and a script TestSpriteAtlas.cs that holds a sprite atlas. I have also an editor script TestSpriteAtlasEditor.cs to create a button in the inspector.

The button calls a method in the TestSpriteAtlas.cs that gets a sprite out of the atlas (by the name of the sprite) to assign it to the sprite renderer. Background: I have a Tree prefab with different grow stages and want to load according to the set grow stage the corresponding sprite + this should be possible in editor mode to make level design easier.

Here is what happens: In editor mode I hit the button and the right sprite is loaded and displayed. No error so far. If I now make some changes in the scene with this prefab e.g. change the position and save the scene everything is still fine but if I do it a second time than the GUID error occurs.

If I open the scene file Test.unity (YAML) which is referenced in the log I see this:

texture: {fileID: 2, guid: 00000000000000000000000000000000, type: 0}

This line is part of the component m_AtlasRD see screenshot: GUID_Error_in_Test_Scene.

If I change the line above to:

texture: {fileID: 2}

the error is gone but it comes back if I move the prefab around in the scene again and save the scene. The error is also displayed right after the starting Unity.

For further investigations I also look in my git change log after the error appears (made a commit in error free state before). There I see the expected changed position of the prefab in the scene but also that the were some changes in the binary file assetDatabase3 (see screneshot: Test_scene_changes_after_GUID_error_appears). Unfortunately this file is not readable.


My unsuccessful attempts (up to now) to get rid of the GUID error:

  • closing unity deleting the Library
    folder (file assetDatabase3 is part
    of that) and restart unity

  • deleting
    the meta files of the prefab
    gameobject

  • Adding some commands for
    updating and saving in the editor
    script:

      serializedObject.Update(), serializedObject.ApplyModifiedProperties(), EditorUtility.SetDirty(mySpriteAtlasObjectTest)
    

(see comments in code below)

  • The sprite packer mode in unity (project settings/editor) is set to Always Enabled if I set it to Always Enabled (Legacy Sprite Packer) the GUID errors disappear but the sprites aren’t loaded in play mode.

So the error clearly has something to do with the sprite atlas. It only appears if i load a sprite out of the atlas in editor mode. I assume it has something to do with sprite clone that is created and assigned to the sprite renderer but I’m not sure why that happens.

Has anybody an idea how I could fix the problem or exactly what causes the error???


See below the code of the MonoBehaviour and the Editor script:

TestSpriteAtlas.cs

 using UnityEngine;
using UnityEngine.U2D;

public class TestSpriteAtlasObject : MonoBehaviour
{
    public SpriteAtlas TestAtlas;
    private SpriteRenderer _spriteRenderer;

    void Start()
    {
        _spriteRenderer = GetComponent<SpriteRenderer>();
        _spriteRenderer.sprite = TestAtlas.GetSprite("AleppoPine_WateredGround");
        ChangeSpriteToWateredGround();
    }

    public void ChangeSpriteToWateredGround()
    {
        _spriteRenderer = GetComponent<SpriteRenderer>();
        _spriteRenderer.sprite = TestAtlas.GetSprite("AleppoPine_WateredGround");
    }
}

TestSpriteAtlasEditor.cs

using UnityEngine;
using UnityEditor;

[CustomEditor(typeof(TestSpriteAtlasObject), true)]
public class SpriteAtlasTestEditor : Editor
{
    // On Inspector GUI
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();
        TestSpriteAtlasObject mySpriteAtlasObjectTest = (TestSpriteAtlasObject) target;

        // button in inspector
        if (GUILayout.Button("Set Watered Ground Sprite"))
        {
            mySpriteAtlasObjectTest.ChangeSpriteToWateredGround();
            //serializedObject.Update();
        }

        // applies custom changes made in the inspector in unity
        //serializedObject.ApplyModifiedProperties();

        // when pressing Strg + S all made changes are saved
        // see https://answers.unity.com/questions/927689/scriptableobject-asset-not-saved-to-disk.html
        //EditorUtility.SetDirty(mySpriteAtlasObjectTest);
    }
}

I have the same problem but mine lets me build the game for mobile but it will randomly make certain UI elements invisible but still clickable where they are supposed to be

Some of my buttons that are placed in a Canvas set to World Space don’t show up but they are still clickable and intractable. I know their position is anchored well they are just not being rendered. They are all also set to UI layer and the camera is set to render UI.
However, some objects show up and some don’t.
I didn’t really change anything before building the game to test on iOS. Because it used to work just fine until it decided to act this way.

To illustrate my problem, I have uploaded a video on youtube to show how it’s all fine in the editor but once built, some of the UI objects disappear but still clickable and intractable!
You will notice how when the sprite that was set to show when a button is pressed, is shown when I click the invisible button but then disappears as I let go of the button.

UPDATE:

I noticed I keep getting this error which I think ought to be the main issue:

Error: Could not extract GUID in text file Assets/Scenes/AlchemistHouse.unity at line 28923.

Unfortunately, it’s not just that line its 88 more lines right below it ! so 89 GUID aren’t being extracted ?!!

Youtube link here:

Problem randomly started happening after 2018.1+

Hello Unity guys,

I have the same problem here on my project.
This thread in full of detailed information, please do something about !
Anyone has found a solution ?
Thanks !

same problem and when I read this thread I couldn’t find a straight answer
error:

Could not extract GUID in text file Assets/Scenes/MainMenu.unity at line 14592.

I solved the problem inserting this code [ExecuteInEditMode] in my class, not in my editor class but in my main class