No announcement yet.

Crash on play from Localization

  • Filter
  • Time
  • Show
Clear All
new posts

    Crash on play from Localization

    I'm currently trying to split my rather large HUD class up into separate classes that inherit from a central HUD. I then want to reference these inherited HUDs to draw different things at different times during the game. It all seems fine up to now and compiles, however I keep getting an error whenever I go to spawn the child class. The error lies here:

    TSharedRef<FString, ESPMode::ThreadSafe> FTextLocalizationManager::GetString(const FString& Namespace, const FString& Key, const FString* const SourceString)
    which is called from here:

    FText::FText( FString InSourceString, FString InNamespace, FString InKey, int32 InFlags )
    	: DisplayString( FTextLocalizationManager::Get().GetString(InNamespace, InKey, &InSourceString)/* <--- This function call*/ )
    	, Flags(InFlags)
    	, Revision(FTextLocalizationManager::Get().GetHeadCultureRevision())
    	History = MakeShareable(new FTextHistory_Base(InSourceString));
    This all stems from when I go to setup the first of my text which is localized:

    MainMenuButtonNames[0] = NSLOCTEXT(LOCTEXT_NAMESPACE, "Menu_Play", "Quick Match");
    At the top of my .cpp, I define the namespace: #define LOCTEXT_NAMESPACE "ProjectName" and then "#undef LOCTEXT_NAMESPACE" at the end of that .cpp. However, when I inherit from this main HUD class and try and spawn a reference to the child HUD, it seems to cause a crash here and I cannot understand why at all, especially as the child class is empty apart from it's constructor at the moment.