# 5.8 InstancedFoliageActor.add\_instances crash editor

**URL:** <https://forums.unrealengine.com/t/5-8-instancedfoliageactor-add-instances-crash-editor/2743650>\
**Category:** Programming & Scripting\
**Tags:** crash-editor, unreal-engine, bug-report\
**Created:** [August 14, 2026, 5:50am UTC](https://forums.unrealengine.com/t/5-8-instancedfoliageactor-add-instances-crash-editor/2743650 "2026-08-14T05:50:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![obilang](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@obilang](https://forums.unrealengine.com/u/obilang)\
**Post date:** [August 14, 2026, 5:50am UTC](https://forums.unrealengine.com/t/5-8-instancedfoliageactor-add-instances-crash-editor/2743650/1 "2026-08-14T05:50:34Z")

</div>

The problem is when enabling the Mesh Partition plugin in 5.8. Then use python to add an instance to a foliageactor. Then the editor will crash.

```python
import unreal
w = unreal.get_editor_subsystem(unreal.UnrealEditorSubsystem).get_editor_world()
ft = unreal.EditorAssetLibrary.load_asset('/Game/Test/NewInstancedStaticMeshFoliage')
unreal.InstancedFoliageActor.add_instances(w, ft, [unreal.Transform()])

```

---

<div class="post-metadata">

**Author:** ![obilang](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@obilang](https://forums.unrealengine.com/u/obilang)\
**Post date:** [August 14, 2026, 6:02am UTC](https://forums.unrealengine.com/t/5-8-instancedfoliageactor-add-instances-crash-editor/2743650/2 "2026-08-14T06:02:27Z")

</div>

And here are analysis from Claude Code  
**[5.8] Foliage AddInstances() crashes when the MeshPartition plugin is enabled**

**Version:** 5.8.1 | **Platform:** Win64 Editor | **Repro:** 100%

### Repro

1. New blank project, enable the **MeshPartition** plugin (Experimental), restart.
2. Run in the Python console:

```python
import unreal
w = unreal.get_editor_subsystem(unreal.UnrealEditorSubsystem).get_editor_world()
ft = unreal.EditorAssetLibrary.load_asset('/Game/FT_Test') # any UFoliageType
unreal.InstancedFoliageActor.add_instances(w, ft, [unreal.Transform()])

```

Editor crashes with `EXCEPTION_ACCESS_VIOLATION reading address 0x10`.  
The Blueprint `Add Instances` node crashes identically. Disabling MeshPartition  
fixes it.

### Root cause

`FFoliageInstanceBaseCache::AddInstanceBaseId()` calls the new-in-5.8  
`IFoliageEditModuleBase` hook _before_ null-checking the component  
(`Runtime/Foliage/Private/FoliageInstanceBase.cpp:126`):

```cpp
if (IFoliageEditModuleBase* FoliageModule = IFoliageEditModuleBase::Get(); ensure(FoliageModule))
{
    bIgnoreComponentClass = FoliageModule->ShouldIgnoreComponentForBaseID(InComponent); // nullptr
}
#endif
if (InComponent && !InComponent->IsCreatedByConstructionScript() && !bIgnoreComponentClass) // too late

```

and the implementation dereferences it unguarded  
(`Editor/FoliageEdit/Private/FoliageEditModule.cpp:262`):

```cpp
for (TSoftObjectPtr<UClass> ClassToCheckPtr : ComponentBaseIDClassesToIgnore)
    if (UClass* ClassToCheck = ClassToCheckPtr.Get())
        if (InComponent->IsA(ClassToCheck)) // <-- AV, InComponent is null

```

`AddInstanceImpl` (`InstancedFoliage.cpp:2281`) passes null because  
`FFoliageInstance`s created by the `AddInstances` UFUNCTION have no  
`BaseComponent`, and the API doesn’t expose one. Interactive brush painting  
survives only because it has a real hit component.

The crash needs `ComponentBaseIDClassesToIgnore` to be non-empty, and the only  
thing in the engine that populates it is  
`FMeshPartitionEditorModule::RegisterFoliageBaseIDClassIgnoreList()`  
(`MeshPartitionEditor/Private/MeshPartitionEditorModule.cpp:143`), which  
registers three classes at startup. Hence: MeshPartition on = every scripted  
foliage add crashes.

### Regression

New in 5.8. 5.7 had no hook and null-checked first:  
`if (InComponent && !InComponent->IsCreatedByConstructionScript())`.

### Fix

One line in `ShouldIgnoreComponentForBaseID`:

```cpp
if (!InComponent) { return false; }

```

(or guard the call site in `AddInstanceBaseId` — ideally both).
