How to add function in the C++ "Class '/ Script / Foliage.FoliageInstancedStaticMeshComponent'

I am not experienced in C ++ but in version 4.19 onwards they removed the option “Use Dynamic Instance Buffer” from the child class blueprint created manually from the “C ++ FoliageInstancedStaticMeshComponent” of the engine, now I need to add the function in C ++ in this asset to be able to remove and add instances of the foliage during play in Standalone or packaged.

On this website show my blueprint code: Part 1 Access > | PasteBin For Unreal Engine 4 Sorry for the graphs are a little cluttered.

The purpose of this graph is to obtain all instances of a foliage static component from the foliage actor and remove all instances of the specified instantiated static mesh “index 4” it gets the reference correctly, but when removing the instance it returns true but nothing happens.

I saw in this forum that following these procedures, the ones I located in the first phase, I would be successful, but in the part of activating the option “Use Dynamic Instance Buffer” I was unable to proceed because the option does not exist in the latest versions of the engine so mine solution is to add this function in C ++ in Class ‘/ Script / Foliage.FoliageInstancedStaticMeshComponent’ but I don’t know how to do it, could you help me?

Any idea???