Adding/Removing Foliage Instances at Runtime crashes editor

I’ve run into an issue where adding and removing instances from the foliage instance static mesh component is crashing the editor.
I have two foliage types, Tree_Oak_03 and Tree_Oak_03_Snow.
I have a weather system which affects a certain radius on the map and changes from summer to winter and vise versa. Map defaults as summer.
The trees within the weather system radius are switched out depending on which season it is.
I’ve painted a handle full of Tree_Oak_03 on the map using the Foliage Mode.
I painted Tree_Oak_03_Snow as well but deleted all instances. I painted the snow version so that a foliage instance static mesh component was created for that type.

A couple of test cases I’ve created:
1.

  • All instances of Tree_Oak_03 are within the weather system radius.
  • No Tree_Oak_03_Snow instances exist
    If all the trees are within the radius of the weather system, the editor doesn’t crash and all trees are swapped to the snow version. I can then reverse the process and change them back to Tree_Oak_03. I’m able to repeat that entire process multiple times over.
  • All instances of Tree_Oak_03 are within the weather system radius ( minus one that’s outside the radius )
  • No Tree_Oak_03_Snow instances exist
    If just one tree is outside of the radius of the weather system, all trees except that one are switched over to Tree_Oak_03_Snow. I reverse the process and change them back to Tree_Oak_03. No problem.
    However, as soon as I attempt to switch to winter a second time is when the editor crashes.
    It looks like the issue occurs during the ‘remove instances’ node when removing
    Tree_Oak_03.
  • All instances of Tree_Oak_03 are within the weather system radius ( minus one that’s outside the radius )
  • One Tree_Oak_03_Snow exists outside of the weather radius.
    During this run, the trees switch to winter no problem, but then crash when switching to summer.
  • Same example and outcome as #3 but the one Tree_Oak_03_Snow was within the radius.

Anyways, I can’t for the life of me figure this out and would love any help.

The weather system BP Function

If you really want to do it this way, I would make the HISM instance yourself, rather than relying on one you ‘made earlier’ with the foliage tool.

Although, a much easier way, would be to just change the material on those instances :slight_smile:

An even easier way would be to give them all the same material, but only change the parameters for snow on some of them.

Easier still, would be to make a single material with a couple of material parameter collection parameters. One for the player positon, and one for the amount of snow. Then you could just set that pair of parameters from the player, and you’re done :slight_smile:

I think I may need to go with the HISM method as I would like to eventually change the mesh along with the material instance. My plan is to have various biomes in the same map with all foliage being harvestable.

'Although, a much easier way, would be to just change the material on those instances

‘An even easier way would be to give them all the same material, but only change the parameters for snow on some of them.’

Perhaps I’m misunderstanding these two suggestions but wouldn’t changing the material on some instances change the material for all instances since it’s one instance static mesh component?

Yes, brain seizure.

But, the last method would work with instance ( MPC ).