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"

Packaged Game crashes after 1 min when Creating Widget on Multiplayer

Been working on a small multiplayer game that ain't too big and I have recently run in to a problem I can't solve during package build testing. After Lobby when I enter my battle map, I can play perfectly for 1 minute but after that if I switch my UI the game crashes when creating Widgets. I switch between Battle and Result UI, and you can enter back to battle if needed. I had a similar problem with my Battle Camera but I fixed that by making a different camera inside Character class instead of having a separate camera class.

Any help would be greatly appreciated since I'm stuck atm.

The problem occurs when I call createWidget() function. I also did try a normal CreateWidget but that also crashes for some reason.

Error Log

 [2017.09.30-19.25.44:570][385]LogMC: Warning: AMCBattleHud(25): GKCrash - CreateBattleWidgets - Create Widget on next Line
 [2017.09.30-19.25.44:907][385]LogWindows: Error: === Critical error: ===
 [2017.09.30-19.25.44:907][385]LogWindows: Error: 
 [2017.09.30-19.25.44:907][385]LogWindows: Error: Fatal error!
 [2017.09.30-19.25.44:907][385]LogWindows: Error: 
 [2017.09.30-19.25.44:907][385]LogWindows: Error: Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0xffffffff
 [2017.09.30-19.25.44:907][385]LogWindows: Error: 
 [2017.09.30-19.25.44:907][385]LogWindows: Error: MystrasChampion.exe!0x00000000E25A6EE6
 [2017.09.30-19.25.44:908][385]LogWindows: Error: MystrasChampion.exe!0x00000000E25D7B52
 [2017.09.30-19.25.44:908][385]LogWindows: Error: MystrasChampion.exe!0x00000000E2B8F4A2
 [2017.09.30-19.25.44:908][385]LogWindows: Error: MystrasChampion.exe!0x00000000E2B52AF2
 [2017.09.30-19.25.44:908][385]LogWindows: Error: MystrasChampion.exe!0x00000000E2F0C6E6

Code

 /**
     * Check if we can create a widget or not
     */
     FORCEINLINE bool areRequirementsOkay(const UWorld* inWorld, const UClass* inWidgetClass) const
     {
         MCLog("GKCrash - areRequirementsOkay - Enter");
         // Check if World Exist
         if (inWorld == nullptr)
         {
             MCLogError("Fail to have World");
             return false;
         }
         // Check if we have Data Asset
         if (WidgetAssetsHandler == nullptr)
         {
             MCLogError("Fail to have Data Asset");
             return false;
         }
         // Check if we have a class
         if (inWidgetClass == nullptr)
         {
             MCLogError("Fail to have User Class");
             return false;
         }
         // Check if UI class is of type MCBaseUserWidget
         if (inWidgetClass)
         {
             if (!inWidgetClass->IsChildOf(UMCBaseUserWidget::StaticClass()))
             {
                 MCLogErrorFormat("Class '%s' Failed to be a class of UMCBaseUserWidget", *inWidgetClass->GetName());
                 return false;
             }
         }
         MCLog("GKCrash - areRequirementsOkay - Exit Okay");
         return true;
     }
 protected:
     /**
     * Creates a Widget and returns a value for storing
     */
     template<class T>
     T* createWidget(UClass* UserWidgetClass, int32 ZOrder = 0)
     {
         MCLog("GKCrash - createWidget - Enter");
         T* foundClass = nullptr;
         UWorld* const World = GetWorld();
         bool const isCheckOkay = areRequirementsOkay(World, UserWidgetClass);
         // Widget to Create
         if(isCheckOkay)
         {
             MCLog("GKCrash - createWidget - CreateWidget");
             foundClass = CreateWidget<T>(World, UserWidgetClass);
             MCLog("GKCrash - createWidget - AddToViewport");
             foundClass->AddToViewport(ZOrder);
         }
         else
         {
             MCLogWarning("---------------- Fail to create a widget");
         }
         MCLogFormat("GKCrash - createWidget - Exit hasClass:%s", foundClass != nullptr ? TEXT("true") : TEXT("false") );
         return foundClass;
     }
Product Version: UE 4.17
Tags:
more ▼

asked Sep 30 '17 at 07:40 PM in C++ Programming

avatar image

wettrix
96 12 18 25

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

1 answer: sort voted first

After another day of investigation I found out that the problem was related to the Data Asset that stores all my widgets. I guess it gets garbage collected or something and it breaks the TSubclassOf, null checks also failed. So to solve this in the easiest way I did a get the data asset before creating a widget and it solved it. I had a similar problem with my camera and it had all the settings inside the specific Camera data asset so I just store all the values on initialize and it solved everything.

more ▼

answered Oct 01 '17 at 04:24 PM

avatar image

wettrix
96 12 18 25

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
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