When creating a new NiagaraSystem, the DefaultEffectType set in ProjectSettings should be reflected. If another EffectType is already set, it should be respected. The problem here is that when creating a new NiagaraSystem, if you select "New system from a template or behavior example" or "Copy existing system", the EffectType is not reflected and none is set.
This is because InitializeSystem() is not executed in case "SystemToCopy ! = nullptr" in UNiagaraSystemFactoryNew::FactoryCreateNew. The following is a work-around but porting the DefaultEffectType setting executed in InitializeSystem() to UNiagaraSystemFactoryNew::FactoryCreateNew (needs to be cleaned up due to duplicate).
Workaround in UE5.3:
// if the new system doesn't have a thumbnail image, check the thumbnail map of the original asset's upackage if(NewSystem->ThumbnailImage == nullptr) { FString ObjectFullName = SystemToCopy->GetFullName(); FName ObjectName = FName(ObjectFullName); FString PackageFullName; ThumbnailTools::QueryPackageFileNameForObject(ObjectFullName, PackageFullName); FThumbnailMap ThumbnailMap; ThumbnailTools::ConditionallyLoadThumbnailsFromPackage(PackageFullName, {FName(ObjectFullName)}, ThumbnailMap); // there should always be a dummy thumbnail in here if(ThumbnailMap.Contains(ObjectName)) { FObjectThumbnail Thumbnail = ThumbnailMap[ObjectName]; // we only want to copy the thumbnail over if it's not a dummy if(Thumbnail.GetImageWidth() != 0 && Thumbnail.GetImageHeight() != 0) { ThumbnailTools::CacheThumbnail(NewSystem->GetFullName(), &Thumbnail, NewSystem->GetOutermost()); } } } // modfier start { const UNiagaraSettings* NiagaraSettings = GetDefault<UNiagaraSettings>(); check(NiagaraSettings); UNiagaraEffectType* RequiredEffectType = NiagaraSettings->GetRequiredEffectType(); if (RequiredEffectType != nullptr) { NewSystem->SetEffectType(RequiredEffectType); } else { UNiagaraEffectType* DefaultEffectType = NiagaraSettings->GetDefaultEffectType(); if (DefaultEffectType != nullptr) { NewSystem->SetEffectType(DefaultEffectType); } } } // modfier end
1. Create a new NiagaraEffectType
2. Set the asset created to DefaultEffectType in Project Settings
3. Select "Copy existing system", uncheck "Library only" and select "Radial Burst" to create a new Niagara System
4. Check the created SystemProperties
Result:
EffectType is none
Expected:
EffectType is set to the DefaultEffectType set in ProjectSettings.
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-190947 in the post.
0 |
Component | UE - Niagara |
---|---|
Affects Versions | 5.2 |
Target Fix | 5.5 |
Created | Jul 24, 2023 |
---|---|
Resolved | May 21, 2024 |
Updated | Aug 13, 2024 |