Prefab not saving changes bug

I have some prefabs that have the same script attached to them.
I change properties of these prefabs through an Editor script.
After reopening unity or building the properties of some of these prefabs are getting reseted to what ever they were before I used my Editor script.

Tryed to use AssetDatabase.SaveAssets(); but didnt help.

Is it a bug? or am I doing something wrong.


Fixed the problem by dublicating the problematic prefabs.

when you make changes to prefab copy in the editor (prefab in the scene) you need to press “apply” to apply the changes to the master prefab (the one in the asset list)