Playtesting is saving resource multiple times
bazsupport opened this issue · comments
The resource-groups will be updated whenever the project is saved and Godot saves the project before every launch of the game. This way it can be ensured that all resource group data is up-to-date with the current project before your game is started. I have tried this on projects with thousands of files and I have not yet encountered any noticable slowdown of the startup procedure.
One alternative would be that you have to manually update the resource groups when you change something in your project. This could be done with a special menu entry. But I feel this is easy to forget and might cost significant development time in chasing down "bugs" which were caused by forgetting to update the resource groups.
What are your thoughts on this?
I actually don't mind the current way you have it automated, I was mostly curious why it saves so many times on playtest?
That image you see with the 8 print outs was after pressing playtest, not manual saves. I average about 2-5 of those messages per playtest. So my thought was maybe it's running more then it needed to?
Edit: Or actually is it how many scenes Godot is saving in order to playtest? So maybe I had 8 different changes between scenes/scripts that it needed to be saved when playtest was pressed?
Hmm that is odd indeed. The plugin reacts to the _save_external_data
call from the godot editor, so if this appearing 2 to 5 times then it is because the editor calls it that often. Now the interesting part would be why does the editor call it this often when you play the game? Are you using other plugins or custom scripts that run or do you manybe press Ctrl+S a lot?
I did some searching and it's a known issue here godotengine/godot#29468.
seems like if put print() in _save_external_data() it will definitely print multiple times when click "Run" in editor.
seems like if put print() in _save_external_data() it will definitely print multiple times when click "Run" in editor.
Ok so it's only printing that much, it's not actually resaving a bunch?
It is resaving stuff multiple times when being called multiple times. As a workaround the plugin could maybe remember the last time it resaved and if its only a few milliseconds away doesn't do it. Would be nicer if the underlying issue was fixed though.
I tried moving it into the _build
function which fixes the problem when running but because _build
is not run on export it could happen that you export the last state that you ran rather than what is actually inside of the resource groups...
The exporting problem could be addressed with an EditorExportPlugin.