How to Access PCG Graph from Blueprint

Hello I have created a PCG in my level and used Static Mesh Spawner to Spawn some trees
Is there a possibility to use a blueprint to access this Static Meshes and delete them (by instance index?) afterwards…
I’m using a line trace to chop trees by removing the instance using the instance index … but I want to save the instance index and after load use the index to delete the already chooped trees from the pcg? How can I access the PCG from the landscape ?

Already tried to create a pcg within a blueprint and access it but this is not working as well

I have limited experience with PCG. I tend to bake them to static meshes (or instance meshes) once I’m happy with the result. Otherwise, PCG will just regenerate. Either way, if you have instanced meshes, I think you’ll run into issues that predate PCG. Mainly that every time you delete an instance, the instance indexes get reordered. We used to scale down the tree and move it underground instead of deleting it to keep the instance indexes intact. This lets us keep a list of “chopped” trees and we can just move them underground when the level loads.

What does “access the PCG from the landscape” mean? Are you trying to keep PCG generation, but have it not create the “chopped” trees when you load a level? I think that’s possible but that gets into the weeds of PCG. You might be better off keeping the seed and the list of indexes of chopped trees… and pray the index generation stays the same.

Either way, I think we need a bit more info on what you’re doing with PCG. Are you keeping PCG generation or are you manually baking it to static mashes?

Thanks so far, I didn’t know the pcg changes the index if entries got deleted :confused: I’m kinda noob in the whole Unreal and started around 1,5 year ago with U5 so I’m to so good at the whole BPs etc.

With PCG on Landscape I mean I created a PCG and droped it into my level / landscape (not creating it withing a blueprint etc.) its generating the same trees every start and nothing is baked

My idea was every new start of the game the PCG generates automatically all the tree and then a function / BP delete the one from my save (I save the index into a savegame as array and on game start I load it back into an array)

Scalling it down would probably also work to keep the index the same, thats a good idea but I still need to know (based on the index) which trees needs to be scaled down (“chopped”)

My other idea was to spawn a BP (mayby a tree stump) in the place of the chopped trees and use this to exclude (use the difference node in the PCG - I already use this method if I place e.g. a campfire to delete the whole grass and trees around - its a BP with a TAG) to exclude/delete the tree in this place but this solutions will probably start lagging and dropping my frames if there are a lot of BPs… it takes 0,5sec around to delete the trees with this method, If i have 20-30 or more it will pause the game for a few second until the trees are excluded - this is not a good solution …

I already have a solution which save all my building BPs (campfire, shelter etc. thats why I thought about the idea with the exlude because I can save and load in my bp “stump” the same way I’m saving loading in my builded BPs (actor transform / actor class etc.)

I can try to bake the trees from the pcg to static but the problem stays the same, I dont know how to access the tress after starting the game

ps. Maybe an Idea (if this is possible) would be to change the mesh after loading the game (the chopped trees) to another one, to the tree stump mesh this way the index would also stay the same but as already mentioned I need to access the “chopped” trees anyway somehow (it is spawned via the hierarchical instant static mesh component and I’m unable to access to it - it only works via line trace > break result > other component > — when I chop it)