Repository navigation
Set CEF main bundle path on MacOS so the engine works inside player builds - #441
Open
Z-Oleksandr wants to merge 1 commit into
Open
Z-Oleksandr wants to merge 1 commit into
Z-Oleksandr wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
On MacOS the CEF engine works in the Editor but crashes in player builds. The case discussed in #374. Every helper process dies on startup and the engine gives up:
Unity then reports
It appears that the engine process has quit!, followed byEndOfStreamExceptionon every input event. The macOS crash reports show the helpers stopping on an internal assertion (EXC_BREAKPOINT/SIGTRAPinsidecef_execute_process).The cause
CefSettings.MainBundlePathis never set. CEF documents that an empty value defaults to the top-level app bundle. In the Editor,UnityWebBrowser.Engine.Cef.appis the top-level bundle. In a build it is embedded in<Game>.app/Contents/Frameworks/, so CEF treats the Unity player as its main bundle, and every helper fails at startup.I reproduced this without Unity by running the engine executable directly, with the same arguments UWB passes:
.app(a dummyOuter.app/Contents/Frameworks/)--main-bundle-path=<engine .app>on the command lineThis is also why moving the engine outside the player's
.appworks around the problem, as described in this comment. The hardened runtime isn't required to trigger it: my player build was ad-hoc signed without the hardened runtime and still crashed. Code signing isn't the cause either. Re-signing the engine and the app ad hoc (inside-out) makescodesign --verifypass, but the crash stays.The change
On MacOS, set
MainBundlePathto the engine's own.app. It is resolved as../..from the working directory, the same base the existingframeworksPathuses (Contents/MacOS->.app):Windows and Linux are untouched. The engine can now stay in
Contents/Frameworks/, where the existing post-processor puts it, so no changes are needed on the Unity side.Testing
Apple M1 Max, macOS 26.6.2, Unity 6000.3.25f1. Engines built with
build_cef_macosarm64.py/build_cef_macosx64.py(CEF 143.0.13)..app.app(under Rosetta)Notes