Why unity executes scripts in prefabs which are not on scene?

Why? What is the reason. How to turn this feature off?

Scripts are marked with [ExecuteInEditMode] attribute, which is needed.
The result is some gameobjects are generated and a thrown on a scene for no reason, with now parents and no purpose.

PS. Should clarify tha this happens for objects which update their state on OnValidate event, which is called every time it is selected in Project view.

Check activeInHierarchy on yourself and don’t execute code if you are not active/inScene…