Unity automatically "applies prefab changes" to selected GameObject when going to Play mode

When going to Play mode in Editor, the Game Object selected in hierarchy applies its changes to its Prefab, like pressing the Prefab Apply button in inspector. This has caused a lot of mistakes in our project, if designers forget to select a non-prefab object before pressing play.

It started when we upgraded to Unity 2017.3.0f3 from 2017.1.1p2. It doesn’t happen on new projects, but it occurs with every PC when editing this project.

Is it a Unity bug or some obscure setting we have accidentally turned on? Any ideas why this could be happening?

I finally solved the issue hooking a logging callback to PrefabUtility.prefabInstanceUpdated, through which I was able to get the call stack of the prefab applying and found the culprit.

The problem in our case was a 3rd party plugin (Fabric) that caused this from a DLL. It has a malfunctioning setting for “Playmode Persistence” somebody had turned on.

Below is the code I used for finding the problem.

    public class PrefabApplyDetector
        static PrefabApplyDetector()
            PrefabUtility.prefabInstanceUpdated = s => { Debug.LogError("Prefab is applied!", s); };