Mirror icon indicating copy to clipboard operation
Mirror copied to clipboard

Support Edit Prefab Mode

Open Bryan-Legend opened this issue 2 years ago • 1 comments

Open a prefab in edit mode then run the game.

On line 67 of NetworkScenePostProcess.cs the code will stop the game if editor is in Prefab Edit Mode.

Why can't we just do a continue and skip that prefab? It's really annoying to have to be constantly exiting and re-entering prefab edit mode during my workflow.

I edited the code to do a continue; statement there and it seems to work for me. If there's a good reason that's bad, could you add it to the code as a comment?

Like this:

                        // * if we have a prefab open in the prefab scene
                        // * if an unopened scene needs resaving
                        // show a proper error message in both cases so the user
                        // knows what to do.
                        string path = identity.gameObject.scene.path;
                        if (string.IsNullOrWhiteSpace(path))
                        {
                            // Debug.LogError($"{identity.name} is currently open in Prefab Edit Mode. Please open the actual scene before launching Mirror.");
                            continue;
                        }
                        else
                            Debug.LogError($"Scene {path} needs to be opened and resaved, because the scene object {identity.name} has no valid sceneId yet.");

Bryan-Legend avatar Nov 11 '22 04:11 Bryan-Legend

force-exiting was necessary to prevent a bug back with Unity 2019. may not be necessary anymore, I'll take a look (but not highest priority atm).

miwarnec avatar Nov 12 '22 19:11 miwarnec