# How can I add foliage to a terrain generated at runtime?

**URL:** <https://forums.unrealengine.com/t/how-can-i-add-foliage-to-a-terrain-generated-at-runtime/2538099>\
**Category:** Programming & Scripting\
**Tags:** procedural-foliage, unreal-engine, Foliage, CPP, question\
**Created:** [June 2, 2025, 7:56pm UTC](https://forums.unrealengine.com/t/how-can-i-add-foliage-to-a-terrain-generated-at-runtime/2538099 "2025-06-02T19:56:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![evang3071](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@evang3071](https://forums.unrealengine.com/u/evang3071)\
**Post date:** [June 2, 2025, 7:56pm UTC](https://forums.unrealengine.com/t/how-can-i-add-foliage-to-a-terrain-generated-at-runtime/2538099/1 "2025-06-02T19:56:07Z")

</div>

I’m trying to add foliage to a terrain that is generated at runtime in C++. I’ve tried using AInstancedFoliageActor and FFoliageInfo from this [https://forums.unrealengine.com/t/create-foliage-in-c/372115/5](https://forums.unrealengine.com/t/create-foliage-in-c/372115/5). The issue is that this only works in editor and PIE. If I try to build a client it fails. I’d like to use foliage instead of hierarchical instanced static meshes because it seems that they are more performant. At least when testing in the editor. How can I use foliage with a runtime generated terrain or are there alternatives that are just as performant?
