Why my material show in the preview and in the scene but not on the inspector

basically i used a editor script to autoassign materials to my 201 models, the materials are in the same fpçder and have the same name as the no remaped materials on the models, but it only shows the materials on the preview and in the scene, not on the explorer, and, when i save and open again the materials are not there, can someone help me?