Hi!
After upgrading older projects to Unity 2018.2.3f1, I got tons of these kinds of errors when opening a scene or making a build.
Could not extract GUID in text file Assets/_Game/Scenes/level.unity at line 1964.
Could not extract GUID in text file Assets/_Game/Scenes/level.unity at line 4405.
Besides that, everything seems to work fine and this error seems to not break anything.
But, how I can fix them? Anybody faced something similar?
Still the same problem on 2018.2.5f1.
It seems I’m not the only one with this problem.
Same here, when changed any objects they will be 2018.2.6f1
I don’t remember what I have done but I fixed them all. But now a friend is facing the same problem and could not solve it.
Anybody else fixed this and could remember the steps to fix?
Nope, they are still popping up in my scenes on the reg.
I experience the GUID errors as well (working with Unity version 2018.3.6f1). So I created a minimal example in a test scene to reliable reproduce the error. The error says:
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)``` to the editor script (see comments in code below)
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 what causes the error???
See below the code of the MonoBehaviour and the Editor script:
**TestSpriteAtlas.cs**
```csharp
using UnityEngine;
using UnityEngine.U2D;
public class TestSpriteAtlasObject : MonoBehaviour
{
public SpriteAtlas TestAtlas;
//public Tree TestTree;
private SpriteRenderer _spriteRenderer;
// Start is called before the first frame update
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);
}
}
Update: 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.
1 Like
Hello there, I have the same problem here !
I don’t know what object causes the issue, but this is critical !
Please help
@Rafarel I still have the GUID but my advice for starters would be to take a look at the mentioned line in the GUID Error message in your .unity file and the content around. Maybe this gives you a hint.
I ended up switching from spritesheets to reading the sprites in from the Texture2D (e.g. .png) and saving the information into two lists: one list with the actual sprites (value) and one with the sprite names (keys) (like a dictionary, but dictionary can not be serialized that’s why I had to use two lists instead).
My suspicion on this (I’m running into it as well) is that Unity is serializing the .sprite property (in my case it’s on an image component). My prefab editor is showing scene overrides on the .sprite format, and because the image being assigned is coming from a SpriteAtlas, the GUID is null at read-time. I’m currently falling back to not having the sprite shown in edit mode, but this is annoying nonetheless. My current take is that I need to either write my own Image class that won’t serialize the sprite property, or just give up on uGUI and go back to ezGUI.
I don’t know how exactly I got this problem solved, I just hit "Apply’ on all prefabs and this problem solved for me. It was very frustrating I was not able to find much info / solution about this on internet. But I remember I started getting this problem after I had made some changes in prefabs.
Saving a scene under another name, deleting the old one and renaming it back helped me.
5 Likes
I had this error several times (Unity 2018.4.14f - Unity 2019.3.5f), and nothing helped but editing the unity file in a text editor. I think there can be several variations of this error and can be more reasons why this error happens but seems, that Unity Editor sometimes messes up something with sprites and spriteatlases.
For me the following happened, and I tell you how I fixed it.
Before doing anything, I made a backup copy of the unity file.
Unity Editor reported that it cant extract the GUID 000000000000000000000 in line #154435. (see my copied unity file part below) Ok, I inspected what is that. When you search upwards from there you can find the GameObject what has this faulty component. See I have this gameobject called PuckBackGlowRectangle, and we can see, it has 3 components with the orange, green, and brown ids, and they are referenced to an existing component below with those ids, see below.
But the problem is - I found out - that the faulty component (purple lines) which has the GUID 0000000000000000 in it, is not referenced by the GameObject PuckBackGlowRectangle at all! So it is an invisible faulty component, which you can’t see in the Unity Editor (This component seems to try to extract some sprite from an old not existing sprite atlas). So I deleted the purple lines in a text-editor, and voila - one GUID error vanished. (Press CTRL+S in the editor to re-save the unity file and see the error does not appear again)
Here are the part of my unity file (I deleted some not relevant lines to be shorter)
— !u!1 &387080016
GameObject:
m_PrefabAsset: {fileID: 0}
m_Component:
- component: {fileID: 387080017}
- component: {fileID: 387080018}
- component: {fileID: 387080019}
m_Layer: 0
m_Name: PuckBackGlowRectangle
m_TagString: Untagged
m_Icon: {fileID: 0}
m_IsActive: 1
— !u!224 &387080017
RectTransform:
m_ObjectHideFlags: 0
m_Pivot: {x: 0.5, y: 0.5}
— !u!114 &387080018
MonoBehaviour:
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_EditorClassIdentifier:
— !u!222 &387080019
CanvasRenderer:
m_ObjectHideFlags: 0
— !u!213 &387884516
Sprite:
m_ObjectHideFlags: 0
bcf6b7e9c150b644bae9236dba4ed6af: 21300000
m_AtlasTags:
- PlayerCircleSpriteAtlas
m_SpriteAtlas: {fileID: 4343727234628468602, guid: ddd2ac9a0a826824a83a48301b46562b, type: 2}
m_AtlasRD:
serializedVersion: 3
texture: {fileID: 2, guid: 00000000000000000000000000000000, type: 0}
alphaTexture: {fileID: 0}
m_SpriteID: 5e97eb03825dee720800000000000000
— !u!1 &391911290
GameObject:
m_ObjectHideFlags: 0
Unity 2019.4.16f1c1 also have sameproblem,
m_AtlasRD:
serializedVersion: 3
texture: {fileID: 2, guid: 00000000000000000000000000000000, type: 0}
I don’t know why?
Just Change ProjectSetting/Editor Asset Serialization to ForceBinary and it will be gone.
Making this change will make your project not play nice with version control systems.
Life is tough.
Edit: Still present in 2021.2.0a
when you load a sprite using atlas.Getsprite(spriteName), a sprite will create as a clone from atlas, not referrent to assets folder then GUID doesn’t exist, so if you want to load sprite and save to scene using this
var spriteObjects = UnityEditor.U2D.SpriteAtlasExtensions.GetPackables(atlas);
foreach (var item in spriteObjects)
{
if (item.name.Equals("spriteName"))
{
var sprite = AssetDatabase.LoadAssetAtPath<Sprite>(AssetDatabase.GetAssetPath(item));//(Sprite)item is invalid cast!
}
}
otherwise, don’t make your scene dirty.
1 Like