Editor scene export and project save

Hi all,

Another bug I’ve found lately is the way in which the editor saves projects and exports scenes.

The thing is that the files of the assets are still exported with the scene and saved with the project, even if I delete the materials and textures with those assets. So for example if I add a texture A and make a material A1 out of that texture, and then I delete both material and texture, it’s still remained in the editor’s Files section and we don’t have a possibility to delete it from there. After that if I want to export the scene or save the project under a new name and folder - the texture A will still be exported with the scene though it’s not used anywhere in the project anymore.

You can check it with the default project, even if you delete the standard assets from everywhere in the editor - they will still be exported when you save the project into any folder on your drive.

@julien-moreau do you have an idea how to fix this?

Pinging @julien-moreau

Hi @artteq sure! In the « Files » tab I can add an option to delete the files directly using the editor.

Anyway today you can remove the files in the « scene » folder. Once you reopen the project you’ll get notified that these files (that you just removed) haven’t been loaded and this will not break your scene.

Do you prefer an option in the editor or do you prefer removing yourself in the scene folder?

@the-simian this can be a great addition to the workflow documentation. Do you agree?


from the usability perspective it’s a complex question. The thing is that in other editors (Unity or Unreal for example) there is a special command to select the dependencies of a file. So for example if you have a prefab in your project which consists of some meshes, materials and textures, maybe also shaders - then they all will be selected and you can delete them altogether at once from the editor itself.

It’s rather convenient because complex prefabs can consist of multiple files (like hundreds) and it’s always a pain to clean up those files manually, especially if you have a lot of assets in your game. But even more important and difficult is to handle those asset files when they are shared between prefabs or models.

For example, say, there are three models A, B and C. They have textures assigned to them like that:
A - textures 1 and 2
B - textures 1 and 3
C - textures 2 and 4
And it’s a very common practice in game development - to share assets - for bundle size reduction and to enhance performance.

Now imagine a situation where you have to replace model C with some other model, say, D, because the game concept has changed a bit. So you have to delete model C and its textures. If you would simply select all dependent assets and delete them - then you will erase texture 2, which is also used for model A. So ideally there should be a mechanism which allows to select dependent assets, but only those which are not used by other assets.

So basically the option of deleting files from the editor (and updating the scene accordingly) is more user-friendly, especially if you can preview what you are deleting, but some sophisticated solutions are needed for it to be a really useful and helpful instrument.

What do you think @julien-moreau?

1 Like

I should have logged this here, I did notice that after deleting assets they seemed to stay in memory. At the time I was focused on the issue related to mesh importation. Unrelated, but I also noticed an issue with the .env button and .dds files around this time as well, but I’ve not yet had time to log this either.

As for editor behavior, I did notice the clean assets button but it didn’t seem to fix or affect this.

One could do something clever here like use a diff to strip unused assets from the folder. Simply not exporting something you add, delete then export is a huge improvement though.