# Dynamic foliage culling at runtime?

**URL:** <https://forums.unrealengine.com/t/dynamic-foliage-culling-at-runtime/480084>\
**Category:** World Creation\
**Tags:** culling, cull-distance, culling-distance, unreal-engine, Foliage, question\
**Created:** [March 11, 2021, 7:37am UTC](https://forums.unrealengine.com/t/dynamic-foliage-culling-at-runtime/480084 "2021-03-11T07:37:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![candytacod](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@candytacod](https://forums.unrealengine.com/u/candytacod)\
**Post date:** [March 11, 2021, 7:37am UTC](https://forums.unrealengine.com/t/dynamic-foliage-culling-at-runtime/480084/1 "2021-03-11T07:37:16Z")

</div>

I know that I can set the min/max cull distance for the foliage in the editor. Is there a way to set those values dynamically at runtime depending on the quality desired by the user? E.g. at Epic quality, set the cull values to 0, while at low quality, set the cull values to like 1000-2000.

In the `BeginPlay` to my game mode, I added the following

```
for (TActorIterator<AInstancedFoliageActor> foliage(GetWorld()); foliage; ++foliage)
	{
		TMap<UFoliageType*, FFoliageMeshInfo*> foliageInfos = foliage->GetAllInstancesFoliageType();
		TArray<UFoliageType*> foliageTypes = TArray<UFoliageType*>();
		foliageInfos.GetKeys(foliageTypes);
		for (int i = 0; i < foliageInfos.Num(); i++)
		{
			foliageTypes[i]->CullDistance = FInt32Interval(5000, 10000);
		}
	}

```

since that appeared to expose the cull distance values to the C++ code. However, that did not work to change the cull distance when I started the game in standalone mode.

Is there a known way to do this?

The other dumb idea I had is to make two copies of each map, one with no culling, and the other with culling. However, that seems like a very clunky and inefficient way to do it.

---

<div class="post-metadata">

**Author:** ![Talad](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Talad](https://forums.unrealengine.com/u/Talad)\
**Post date:** [April 30, 2022, 9:33pm UTC](https://forums.unrealengine.com/t/dynamic-foliage-culling-at-runtime/480084/2 "2022-04-30T21:33:23Z")

</div>

Hi, I have the same need, did you find a solution?
