In recent versions of GMS2 you may find your project(s) have an issue which causes you to see one or more "Core Resources : Info - Blank IdReference found - could be that the project is corrupt." lines written to your compiler log each time you build the project.
This is because some objects have lost some sprite path values from their .yy file at some point in the past - your project may have had this issue for multiple GMS2 releases, but you didn't know. The current version of GMS2 is smart enough to detect this problem, but currently cannot fix it automatically for you.
It should be said that in the vast majority of cases these messages are harmless (and so this warning message is unlikely to be why your build fails or you have a code error in your game), however it is still worth clearing up any issues with your project and stopping the warnings.
So how do you fix it? This guide will show you.
Or at least don't have the project opened at this time, as we want to make sure any unsaved changes are saved first and we don't want the file watcher to pop up inside GMS2 as we're searching later on. Similarly, if you were editing sprites/code/audio in external editors, make sure those editors are closed also.
Ensure You Have A Suitable Text-Searching Tool
Unless your project is tiny or you have already reduced it a lot in order to locate this issue, you're going to want to use some text-searching tool such as "grep" in order to do the work for you. Otherwise, you would have to manually open every object's .yy file in Notepad/TextEdit/etc. and look through them yourself.
Windows IDE users: we will be using the free tool grepWin (https://tools.stefankueng.com/grepWin.html) as part of this tutorial, but if you already have a similar text-searching tool you are familiar with, just use that instead. Please download and install a suitable tool before continuing with this guide.
macOS IDE users: macOS already has a grep installation by default and you should call it via Terminal using the command:
$ grep -r -w '"name": ""' [the path to your project folder]
e.g., something like
$ grep -r -w '"name": ""' /Users/qa/GameMakerStudio2/projectWithErrors
This will then return your matches immediately, so you can skip the grepWin section immediately below and jump to the "Determine Which Files Need Fixing" heading.
Perform The grepWin Search
Inside grepWin, ensure you're doing a text search and then add in the string to search for as
as you can see here:
The default size restriction of 2000 will usually be fine, but If you know you have some large objects then it's worth just bumping this up as we show above and making sure.
Once you click the Search button it may take a few seconds (depends how big your project is), but then all your matches will be returned.
Determine Which Files Need Fixing
Now you have the list of objects which returned a match for our empty name value, we need to open each of the .yy files for these objects and see if their sprite's path value is also empty. If it is, then this asset is one which will write out the warning line and so needs to be fixed. You can ignore any .yy files for Sprites which appeared in the search results.
Windows/grepWin users: simply right-click the search result and choose Edit from the context menu and then (if required) tell Windows to open the file with your default plaintext file editor. You should not pick GMS2 itself for this.
Mac users: navigate to the files in Finder and open them using your plaintext editor of choice (e.g., TextEdit). You should not pick GMS2 itself for this.
Once you have opened the .yy text file you will be able to see the name and path values up near the top of the file. It will look something like this:
If both values are blank as we show above, make a note of this object as one we need to fix inside GMS2.
If the path value is not blank also, then this one does not need fixing.
Repeat the steps with the next .yy file in your search results, and continue until all object .yy files in the search results have been checked.
Fix Your Assets Inside GMS2
Now you know exactly which objects need fixing inside GMS2 we can finish the process off.
Start GMS2 and open the project now, then open one of the objects you need to fix.
- If it should have a sprite associated with it, simply re-select the correct sprite
- If it does not require a sprite, then you just need to select "None" again
You can select "None" by clicking the sprite picker box and then picking "None" in the popup window, as shown here.
Repeat for all affected objects. Once you have done them all, File > Save your project and build it again. You should now find all the warnings are gone.
If you do see any, it's worth cleaning your project cache one time and doing a second build, but if you continue seeing warnings, then you must have unfortunately missed fixing those objects. Please close GMS2 and then repeat the search again.