File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
Source/PrefabricatorRuntime/Private/Asset Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -106,22 +106,21 @@ UPrefabricatorAsset* UPrefabricatorAssetCollection::GetPrefabAsset(const FPrefab
106
106
else {
107
107
float SelectionValue = Random.FRandRange (0 , TotalWeight);
108
108
float StartRange = 0 .0f ;
109
+ bool bFound = false ;
109
110
for (const FPrefabricatorAssetCollectionItem& Item : Prefabs) {
110
111
float EndRange = StartRange + Item.Weight ;
111
112
if (SelectionValue >= StartRange && SelectionValue < EndRange) {
112
113
PrefabAssetPtr = Item.PrefabAsset ;
114
+ bFound = true ;
113
115
break ;
114
116
}
115
117
StartRange = EndRange;
116
118
}
117
- if (!PrefabAssetPtr. IsValid () ) {
119
+ if (!bFound ) {
118
120
PrefabAssetPtr = Prefabs.Last ().PrefabAsset ;
119
121
}
120
122
}
121
- if (PrefabAssetPtr.IsValid ()) {
122
- return PrefabAssetPtr.LoadSynchronous ();
123
- }
124
- return nullptr ;
123
+ return PrefabAssetPtr.LoadSynchronous ();
125
124
}
126
125
127
126
void UPrefabricatorEventListener::PostSpawn_Implementation (APrefabActor* Prefab)
You can’t perform that action at this time.
0 commit comments