x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

[bug]packaged game stuck at launch

I packaged my project for Mac. No error or warning. But it stuck at some strange points when I ran the game. here is the log when the game stuck. However, on PC, everything work fine. So, I guess this is an engine's bug. Please help me...

update:

After investigation, I have finally located the bug and fixed it. Below is my solution. the bug is in UnrealEngine/Engine/Source/Runtime/Core/Private/Mac/MacWindow.cpp, line 423~432, function FMacWindow::SetWindowMode. It's an infinite do-while loop and it stuck the packaged game launch.

        do
         {
             FPlatformMisc::PumpMessages(true);
             WindowIsFullScreen = [WindowHandle windowMode] != EWindowMode::Windowed;
         } while(WindowIsFullScreen != bMakeFullscreen);

I changed the function as below.

 void FMacWindow::SetWindowMode( EWindowMode::Type NewWindowMode )
 {
     SCOPED_AUTORELEASE_POOL;
 
     // In OS X fullscreen and windowed fullscreen are the same
     bool bMakeFullscreen = NewWindowMode != EWindowMode::Windowed;
     bool bIsFullscreen = GetWindowMode() != EWindowMode::Windowed;
 
     if(bIsFullscreen == bMakeFullscreen && NewWindowMode != GetWindowMode())
     {
         SetWindowMode(EWindowMode::Windowed);
     }
     
     if( bIsFullscreen != bMakeFullscreen || NewWindowMode != GetWindowMode() )
     {
         bool WindowIsFullScreen = !bMakeFullscreen;
         
         NSWindowCollectionBehavior Behaviour = [WindowHandle collectionBehavior];
         if(bMakeFullscreen)
         {
             Behaviour &= ~(NSWindowCollectionBehaviorFullScreenAuxiliary);
             Behaviour |= NSWindowCollectionBehaviorFullScreenPrimary;
         }
         
         if(!bIsFullscreen)
         {
             PreFullscreenWindowRect.origin = [WindowHandle frame].origin;
             PreFullscreenWindowRect.size = [WindowHandle openGLFrame].size;
             WindowHandle.PreFullScreenRect = PreFullscreenWindowRect;
         }
         
         WindowHandle.TargetWindowMode = NewWindowMode;
         
         MainThreadCall(^{
             SCOPED_AUTORELEASE_POOL;
             [WindowHandle setCollectionBehavior: Behaviour];
             [WindowHandle toggleFullScreen:nil];
         }, UE4FullscreenEventMode, true);
         
         // Ensure that the window has transitioned BEFORE leaving this function
         // this prevents problems with failure to correctly update mouse locks
         // and OpenGL contexts due to bad event ordering.
         do
         {
             FPlatformMisc::PumpMessages(true);
             WindowIsFullScreen = [WindowHandle windowMode] != EWindowMode::Windowed;
         } while(WindowIsFullScreen != bMakeFullscreen);
     }
     else // Already in/out fullscreen but a different mode - we should just update the mode rather than forcing the window to change again
     {
         WindowHandle.TargetWindowMode = NewWindowMode;
         [WindowHandle setWindowMode:NewWindowMode];
     }
 }

I copied these codes from GitHub. And the problem solved. Someone may have missed some code. Please fix this bug. My English is poor. I do not know if I described it clearly.

Product Version: UE 4.17
Tags:
newgame.log (6.7 kB)
more ▼

asked Aug 18 '17 at 01:31 AM in Packaging & Deployment

avatar image

wukakuki
213 11 16 23

avatar image wukakuki Sep 28 '17 at 06:34 AM

I do not know what caused this bug. I can not reproduce this error. But I know how to fix this error. There must be some logical error somewhere in the engine. I upgraded my project to version 4.18. This error still exists. I also found the repair method. In the file Engine/Source/Runtime/ApplicationCore/Private/Mac/MacWindow.cpp, insert the following code after line 621.

 NSWindowCollectionBehavior Behaviour = [WindowHandle collectionBehavior];
 Behaviour &= ~(NSWindowCollectionBehaviorFullScreenAuxiliary);
 Behaviour |= NSWindowCollectionBehaviorFullScreenPrimary;
 [WindowHandle setCollectionBehavior: Behaviour];


(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question