Skip material save on scene save

Hello.

I got custom MeshInstance3D mesh where i do apply material on _ready (working as tool in editor too)

when saving the scene with this i would like it to skip applied material (to not save it)

Question reason:
Scene load much longer with no-needed saved material.

Question:
How to not save assigned material on scene save?

Using NOTIFICATION_EDITOR_PRE_SAVE and NOTIFICATION_EDITOR_POST_SAVE you can just temporarily remove the material binding so it is not saved, then rebind it so it stays set in the editor.

2 Likes

Didnt even know there are notifications since im new in Godot.

perfect answer, thank you a lot :slight_smile:

works very nice.


func _notification(n):
	match n:
		NOTIFICATION_EDITOR_PRE_SAVE:
			mesh.surface_set_material(0, null)
		NOTIFICATION_EDITOR_POST_SAVE:
			mesh.surface_set_material(0, material)
1 Like