Hi!
I’m currently developing an editor widget for unreal that requires me to “Resimulate” the foliage generation using the procedural foliage tool.
Until now I was able to recreate the code from the “Resimulate” button (Figue 1) on click event, see the code bellow, but i am getting an error when I try to compile it even tho Itelisense doesn’t give me any errors.
void ULandscapeHelper::Simulate()
{
if (!AssignFoliageVolume())
{
if(GEngine)
GEngine->AddOnScreenDebugMessage(-1,
15.0f,
FColor::Red,
TEXT("Failed to get foliage volume"));
return;
}
TArray<FDesiredFoliageInstance> FoliageInstances;
if (FoliageComponent->GenerateProceduralContent(FoliageInstances))
{
if (FoliageInstances.Num() > 0)
{
FoliageComponent->RemoveProceduralContent(false);
FFoliagePaintingGeometryFilter OverrideGeometryFilter;
OverrideGeometryFilter.bAllowLandscape = FoliageComponent->bAllowLandscape;
OverrideGeometryFilter.bAllowStaticMesh = FoliageComponent->bAllowStaticMesh;
OverrideGeometryFilter.bAllowBSP = FoliageComponent->bAllowBSP;
OverrideGeometryFilter.bAllowFoliage = FoliageComponent->bAllowFoliage;
OverrideGeometryFilter.bAllowTranslucent = FoliageComponent->bAllowTranslucent;
FEdModeFoliage::AddInstances(FoliageComponent->GetWorld(), FoliageInstances, OverrideGeometryFilter, true);
}
}
}
The error text:
LNK2019: unresolved external symbol "public: static void __cdecl FEdModeFoliage::AddInstances(class UWorld *,class TArray const &)" (?AddInstances@FEdModeFoliage@@SAXPEAVUWorld@@AEBV?$TArray@UFDesiredFoliageInstance@@VFDefaultAllocator@@@@@Z) referenced in function "public: void __cdecl USpawnTool::ResimulateAll(void)" (?ResimulateAll@USpawnTool@@QEAAXXZ)
I Found this thread where the person asking add the exact problem that I was having but I wasn’t able to implement the described solution. I still get the same error.