I searched a lot, found nothing. So here’s my question:
I grab the selected prefab in the project view via Selection.selectionChanged ((to check if it is a prefab, selectedObj.scene.rootCount == 0)
Then I instantiate it in the scene using my tool:
var obj = (GameObject)PrefabUtility.InstantiatePrefab(selectedObj, sceneBackup);
When dropped by hand in the hierarchy or scene, it mantains the prefab icon and the parent-instance reference. But when I do it via code, that connection is lost, and the resulting GO is not related in any way to the original prefab in the project, I can’t find a proper way to simulate the drag-drop functionality in the editor.
Ok. I tried a little tool to test this. It worked correctly.
Then moved the code to my original code, and worked… then removed everything and used my previous code, and works correctly.
Maybe this was something that was fixed and I didn’t noticed.
So it works, yes!