I’m analyzing the same issue.
In UnrealEngine\Engine\Source\Developer\ModuleUI\Private\SModuleUI.cpp I found the code below. This code is for the module window.
else if ( ColumnName == "ModuleActions" )
{
...
// Reload button
+ SHorizontalBox::Slot()
.AutoWidth()
.Padding( 2.0f, 0.0f )
[
SNew( SButton )
.Visibility( Item.ToSharedRef(), &FModuleListItem::GetVisibilityBasedOnReloadableState )
.Text( LOCTEXT("Reload", "Reload") )
.OnClicked( Item.ToSharedRef(), &FModuleListItem::OnReloadClicked )
]
And If follow the code in the same file, finally I can meet the function GetVisibilityBasedOnLoadedAndShutdownableState() through GetVisibilityBasedOnReloadableState()
EVisibility SModuleUI::FModuleListItem::GetVisibilityBasedOnLoadedAndShutdownableState() const
{
if ( GIsSavingPackage || IsGarbageCollecting() )
{
return EVisibility::Hidden;
}
const bool bIsHotReloadable = FModuleManager::Get().DoesLoadedModuleHaveUObjects(ModuleName);
const bool bCanShutDown = ( FModuleManager::Get().IsModuleLoaded(ModuleName)
&& !bIsHotReloadable
&& FModuleManager::Get().GetModule(ModuleName)->SupportsDynamicReloading() );
return bCanShutDown ? EVisibility::Visible : EVisibility::Hidden;
}
EVisibility SModuleUI::FModuleListItem::GetVisibilityBasedOnReloadableState() const
{
return GetVisibilityBasedOnLoadedAndShutdownableState();
};
This function checks DoesLoadedModuleHaveUObjects() . I think that Having UObject or Not can affect the visibility of reload button.