Loading XAML Interfaces and Textures in Unreal Engine 5 without Importing
Posted: 09 Jun 2024, 10:51
Hi NoesisGUI Community,
I need some help with loading XAML interfaces and textures in Unreal Engine 5 without importing them directly into the project. I've tried loading the XAML file and casting my parsed result to UNoesisXaml in the constructor of my class that extends public UNoesisInstance, but the interface remains black.
Here is my test code:
Despite the code, my interface stays black. Can anyone provide guidance on the correct approach to load XAML interfaces and textures dynamically in UE5?
Thank you in advance!
Best regards,
P.Claudon
I need some help with loading XAML interfaces and textures in Unreal Engine 5 without importing them directly into the project. I've tried loading the XAML file and casting my parsed result to UNoesisXaml in the constructor of my class that extends public UNoesisInstance, but the interface remains black.
Here is my test code:
Code: Select all
FString XamlFilePath = FPaths::ProjectContentDir() + TEXT("../Assets/ConnectingGUI/MainWindow.xaml");
FString XamlContent;
if (FPaths::FileExists(XamlFilePath))
{
FFileHelper::LoadFileToString(XamlContent, *XamlFilePath);
}
else
{
UE_LOG(LogTemp, Error, TEXT("Xaml not Found : %s"), *XamlFilePath);
}
UNoesisXaml* MyXaml = NewObject<UNoesisXaml>();
if (!XamlContent.IsEmpty())
{
std::string XamlText = TCHAR_TO_UTF8(*XamlContent);
Noesis::Ptr<Noesis::BaseComponent> XamlRoot =
Noesis::GUI::ParseXaml(XamlText.c_str());
BaseXaml = reinterpret_cast<UNoesisXaml*>(XamlRoot.GetPtr());
}
else
{
UE_LOG(LogTemp, Error, TEXT("Error when loading XAML"));
}
Thank you in advance!
Best regards,
P.Claudon