We have become aware of an issue in the Image Editor where the Merge All Layers command doesn't clean your sprite's .yy file properly of the entries for the layers you have now merged, and so results in multiple "Core Resources : Debug Info - Subresource not found" warnings being shown in your compiler log each time you then build your project thereafter.
This guide will help you clean your sprites and stop the warnings.
Note that this compiler line is only a warning and your sprite is not actually broken in any way - your game will still compile fine and the sprite will work in-game with no issues.
What Is The Issue?
When you merge the layers, the old entries in the "compositeImage" section of "frames" inside the sprite's .yy file are not being removed properly when the new merged layer is added. So for each layer which was merged, you will have a matching line of stale information (5 layers merged = 5 redundant lines, and so on).
E.g.: I merged 3 layers into 1 layers and so I should have this in my Sprite2.yy file
"frames": [
{"compositeImage":{"FrameId":{"name":"6db92298-5b46-43dc-a82e-c86cf266082d","path":"sprites/Sprite2/Sprite2.yy",},"LayerId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMSpriteBitmap",},"images":[
{"FrameId":{"name":"6db92298-5b46-43dc-a82e-c86cf266082d","path":"sprites/Sprite2/Sprite2.yy",},"LayerId":{"name":"3c907171-69ba-4fee-9cec-bc77fd35a942","path":"sprites/Sprite2/Sprite2.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMSpriteBitmap",},
],"parent":{"name":"Sprite2","path":"sprites/Sprite2/Sprite2.yy",},"resourceVersion":"1.0","name":"6db92298-5b46-43dc-a82e-c86cf266082d","tags":[],"resourceType":"GMSpriteFrame",},
],
but I incorrectly get this instead
"frames": [
{"compositeImage":{"FrameId":{"name":"6db92298-5b46-43dc-a82e-c86cf266082d","path":"sprites/Sprite2/Sprite2.yy",},"LayerId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMSpriteBitmap",},"images":[
{"FrameId":{"name":"6db92298-5b46-43dc-a82e-c86cf266082d","path":"sprites/Sprite2/Sprite2.yy",},"LayerId":{"name":"85067aa6-d480-41c5-8a18-1d2a481f4996","path":"sprites/Sprite2/Sprite2.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMSpriteBitmap",},
{"FrameId":{"name":"6db92298-5b46-43dc-a82e-c86cf266082d","path":"sprites/Sprite2/Sprite2.yy",},"LayerId":{"name":"0c4abfb2-e987-4bc2-8910-1afd951e9ab8","path":"sprites/Sprite2/Sprite2.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMSpriteBitmap",},
{"FrameId":{"name":"6db92298-5b46-43dc-a82e-c86cf266082d","path":"sprites/Sprite2/Sprite2.yy",},"LayerId":{"name":"89d66b4a-2ffb-4689-bae4-657efc2a2f4b","path":"sprites/Sprite2/Sprite2.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMSpriteBitmap",},
{"FrameId":{"name":"6db92298-5b46-43dc-a82e-c86cf266082d","path":"sprites/Sprite2/Sprite2.yy",},"LayerId":{"name":"3c907171-69ba-4fee-9cec-bc77fd35a942","path":"sprites/Sprite2/Sprite2.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMSpriteBitmap",},
],"parent":{"name":"Sprite2","path":"sprites/Sprite2/Sprite2.yy",},"resourceVersion":"1.0","name":"6db92298-5b46-43dc-a82e-c86cf266082d","tags":[],"resourceType":"GMSpriteFrame",},
],
The compiler is then complaining that it cannot find those 3 redundant sprite frames by writing out 3 warnings that I need to fix Sprite2.
How Do I Clean My Sprites?
We have identified that making a .yyz Export of your project will actually clean this information from sprites where you originally created each layer manually and then merged them. So we would recommend the first thing you do is to File > Export a new .yyz file and then re-import that .yyz as a new copy of your project (not over the top yet!). You may find this fixes all your sprites at once and you don't need to do anything further with this guide.
However, be aware this will not fix cases where you originally created your layers by duplicating an existing layer multiple times. Accordingly, if you still see the warnings when using your new imported copy of your project, it's time to hand-edit the sprites affected.
So how do you do that?
- Build your project for Windows/macOS (whichever is easiest in your IDE) so that you get the compiler lines written out.
- Make a note outside GameMaker of the names of all the sprites affected.
- Right-click on one of the affected sprites in the asset browser and Open In Explorer / Open in Finder. This will open your OS file browser directly on the sprite.
- Now close GameMaker before you go any further. (Say yes to saving any changes if you are asked!)
- Open the .yy file for the sprite in a plain text editor of your choice and then maximise the window.
- You will see the "frames" section is somewhere roughly in the middle of the .yy file. Find it, but do not make any changes yet.
- Instead, look near the bottom of the file for the "layers" section. This will tell us which frames GameMaker still cares about in the Image Editor.
- Take note of the value shown for "name" in this section and find the matching entry in the "frames" section, and then carefully remove all the other lines in "frames".
- Ensure you do not accidentally leave a trailing comma, etc.
- Then close the text file and save the changes.
- Repeat the above for all sprites affected by this issue.
- Then open GameMaker and load your project again and build it once more. Confirm that all the warnings are gone and that the affected sprites are still correct in-game.
- When you're very happy with the cleaned project, only then should you remove your original copy and Save As this one so it has the proper name / update your source control / send it to your team members / whatever.
An Example
Going back to the Sprite2 we mentioned earlier, we see "frames" has 4 entries
"frames": [
{"compositeImage":{"FrameId":{"name":"6db92298-5b46-43dc-a82e-c86cf266082d","path":"sprites/Sprite2/Sprite2.yy",},"LayerId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMSpriteBitmap",},"images":[
{"FrameId":{"name":"6db92298-5b46-43dc-a82e-c86cf266082d","path":"sprites/Sprite2/Sprite2.yy",},"LayerId":{"name":"85067aa6-d480-41c5-8a18-1d2a481f4996","path":"sprites/Sprite2/Sprite2.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMSpriteBitmap",},
{"FrameId":{"name":"6db92298-5b46-43dc-a82e-c86cf266082d","path":"sprites/Sprite2/Sprite2.yy",},"LayerId":{"name":"0c4abfb2-e987-4bc2-8910-1afd951e9ab8","path":"sprites/Sprite2/Sprite2.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMSpriteBitmap",},
{"FrameId":{"name":"6db92298-5b46-43dc-a82e-c86cf266082d","path":"sprites/Sprite2/Sprite2.yy",},"LayerId":{"name":"89d66b4a-2ffb-4689-bae4-657efc2a2f4b","path":"sprites/Sprite2/Sprite2.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMSpriteBitmap",},
{"FrameId":{"name":"6db92298-5b46-43dc-a82e-c86cf266082d","path":"sprites/Sprite2/Sprite2.yy",},"LayerId":{"name":"3c907171-69ba-4fee-9cec-bc77fd35a942","path":"sprites/Sprite2/Sprite2.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMSpriteBitmap",},
],"parent":{"name":"Sprite2","path":"sprites/Sprite2/Sprite2.yy",},"resourceVersion":"1.0","name":"6db92298-5b46-43dc-a82e-c86cf266082d","tags":[],"resourceType":"GMSpriteFrame",},
],
And our "layers" section says we only care about 3c907171-69ba-4fee-9cec-bc77fd35a942
"layers": [
{"visible":true,"isLocked":false,"blendMode":0,"opacity":100.0,"displayName":"default","resourceVersion":"1.0","name":"3c907171-69ba-4fee-9cec-bc77fd35a942","tags":[],"resourceType":"GMImageLayer",},
],
so we modify "frames" to remove all the other lines and just leave the one referring to 3c907171-69ba-4fee-9cec-bc77fd35a942, like so
"frames": [
{"compositeImage":{"FrameId":{"name":"6db92298-5b46-43dc-a82e-c86cf266082d","path":"sprites/Sprite2/Sprite2.yy",},"LayerId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMSpriteBitmap",},"images":[
{"FrameId":{"name":"6db92298-5b46-43dc-a82e-c86cf266082d","path":"sprites/Sprite2/Sprite2.yy",},"LayerId":{"name":"3c907171-69ba-4fee-9cec-bc77fd35a942","path":"sprites/Sprite2/Sprite2.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMSpriteBitmap",},
],"parent":{"name":"Sprite2","path":"sprites/Sprite2/Sprite2.yy",},"resourceVersion":"1.0","name":"6db92298-5b46-43dc-a82e-c86cf266082d","tags":[],"resourceType":"GMSpriteFrame",},
],
and then we close that text file and save the changes.