Why are my instanced static meshes only visible in the viewport?

I’m trying to add foliage inside a blueprint so I created a script in blueprint to procedurally add instanced static meshes using line trace.

In the viewport it looks like this:

but in the level editor or when playing the game, no instanced mesh are visible:


I’ve been looking everywhere and I can’t seem to find the reason why the instanced meshes are not showing.

Is there anything I need to set before using instance meshes?

Found out the problem: