I have an editor tool that performs custom searches within scenes and prefabs in my project. It displays a list of results and when you click on one it opens the scene/prefab and automatically highlights the relevant GameObject. This was written prior to the New Prefab Workflow so for prefabs it opens a new scene and creates a prefab instance inside of it.
I am trying to update it to open the prefab in Prefab Mode, just as if the user had double-clicked the prefab in the Project window. I have tried using PrefabUtility.LoadPrefabContents()
and PrefabUtility.LoadPrefabContentsIntoPreviewScene()
, but that loads the prefab into an “isolated scene” which apparently isn’t visible or interactable in the Editor. I understand how that’s useful for batch operations but I’d also like the option of simply launching into Prefab Mode.
Is there any way to do that?