Opening Prefab Mode failed: Could not detect a Prefab root after loading 'Assets/Prefabs/

Upgraded from b11 to b12 and slowly, one by one, my prefabs no longer open in Prefab Mode. I have to drag them into the scene, modify, save, then delete.

Resaving the prefabs gave them all a new ID which broke references in every Scriptable Object

I got this error after upgrading b11 to b12 too. Right click on the prefab and Reimport to fix

5 Likes

Ah jeez! I wish I knew that a few hours before recreating prefabs and references. Thanks!

A bug report with one of the Prefabs that show this problem would be appreciated. Please post case number here.

Here is a document that describes how to submit a bug-report:
https://unity3d.com/unity/beta/guide-to-beta-testing#tab-3

1 Like

I have tried to reproduce the problem, but it won’t happen anymore.

My version control shows that when it did happen, nothing changed on the prefabs themselves when reimporting, so the problem would likely be in the library folder (which I don’t put into version control).

It is entirely possible just just closing and re-opening the project could have fixed the problem too. I’ve verified that all my prefabs work now, even ones that I did not reimport before.

I’ve done various tests upgrading a smaller sample project with a bunch of prefabs from b11 to b12 but the problem will not happen again…

If I can find a way to reproduce it again I’ll submit a bug report.

I have this problem consistently with Unity 2018.3.0b12 on Mac OS X. I reproduce as follows:

  • Open a prefab
  • Press Command+B to build for Android
  • Attempt to open the same the prefab as before
  • Observe error message instead of expected prefab opening

Opening a different prefab will work. Restarting Unity will unbreak the broken prefab, as will Reimporting the broken prefab using the context menu.

I’d use the bug reporter, but I can’t change attachments there because the attachment file picker doesn’t respond to clicks on any files or folders. I’d attach a prefab here, but I’m not allowed to attach .meta or .prefab files. Since it seems to be related to modifying and building, not the particular prefab, perhaps you’ll manage without the files anyway.

I’ll recheck this thread in case there’s more information I can provide.

Do you have any special build scripts that changes prefab assets when building?
You can also create a small repro project, zip the project and send it directly to me (mads@unity3d.com)

Here’s a repro that doesn’t rely on a large and proprietary project:

  • Create new project

  • Add a game object called Prefab to SampleScene, drag it to the Assets folder to make a prefab, and delete it from the scene

  • Create a new C# script containing a public member variable of type GameObject

  • Add another game object to SampleScene, add the script to it, and drag the prefab to the script’s member variable

  • Open the prefab

  • Build the project. This will close the prefab

  • Attempt to open the prefab

  • Observe unexpected error: Opening Prefab Mode failed: Could not detect a Prefab root after loading ‘Assets/Prefab.prefab’.

  • Set the script’s member variable to None

  • Open the prefab (you’ll have to reimport it or reopen Unity)

  • Build

  • Attempt to open the prefab

  • Observe the opened prefab as expected

Still haven’t tested on anything except Mac OS X and Unity 2018.3.0b12, but have now tested with both Android and standalone build targets.

If you still can’t repro, I’ll do it again and mail you the project, but I think you should have no trouble now.

2 Likes

Good catch @sethwklein

I was able to reproduce this in 2018.3 b12 using your steps. Also confirmed that this bug does not happen in 2018.3 b11.

I’ve submitted a bug report with my small test project with the following info:

1. What happened
Double clicking to edit a prefab results in an error:
Opening Prefab Mode failed: Could not detect a Prefab root after loading ‘Assets/Prefabs/Prefab_Empty.prefab’.

This bug report is for the following forum thread:

2. How we can reproduce it using the example you attached

  1. Open the project in 2018.3 b12
  2. Double click on each prefab in the Prefabs folder to confirm they all work
  3. Close the prefab view (exit prefab editing)
  4. Build the project
  5. Double click on each prefab in the Prefabs folder again

Expected Result
Should still be able to edit the prefabs

Actual Result
Opening Prefab Mode failed: Could not detect a Prefab root after loading ‘Assets/Prefabs/Prefab_Empty.prefab’.

I’ll post the bug # once it is available.
EDIT: Case 1107035

2 Likes

Thanks @sethwklein now we reproduce it as well (and thanks to @Doug-Wolanick for creating the issue for it)

1 Like

Here’s the Issue Tracker link: Unity Issue Tracker - [Improved Prefabs] After building a Player opening Prefab Mode fails with: 'Could not detect a Prefab root after loading'

1 Like

@sethwklein , @Doug-Wolanick
This issue has now been fixed. Thanks again for reporting the issue.

The fix will be included in the next release.

1 Like