I have a niagara system that has a user parameter of type mesh array. I then have a blueprint that also contains an array of meshes. I need to keep these two arrays in sync. At the moment I just do it manually in editor, which is error prone. I cannot sync these arrays at runtime because the niagara system is controlled by an NDC, so you cannot directly access the system or its emitter instances. I also cannot use an NDI as they are not exposed properly to blueprint. So, unless there is another option I’m not thinking of, I’m left with manual syncing. Then I thought I could create a blueprint utility that might be able to automate it; by reading the array in the blueprint asset and populating the array in the niagara system asset or vice versa. Then I just keep one updated and run a script to sync them. Does anyone know how I could do this. I can’t seem to figure out this blueprint scripting or if what I want to do is even possible?
make the blueprint array the single source of truth and push it to the system instead of keeping two arrays to sync manually:
declare the user parameter of mesh array type on the niagara system, then on every change of your blueprint array (add, remove, reorder) write the whole array into the system parameter in one call and let the emitters read it. the manual editor duplication you are doing now disappears because the system never owns the list, it only mirrors it.
the catch you already hit: with an ndc controlled system you cannot reach the emitter instances directly, and stock blueprint has no way to write a mesh array parameter at all, there is no set array node for it. c++ can do it through the component interface (the SetNiagaraArray family writes user array parameters including mesh arrays), so the usual pattern is a small blueprint function library exposing one node: pass your TArray of static mesh references, it writes the user parameter, done. spawn instances from the data channel read the user parameter on activation so every spawned instance is in sync automatically.
if the spawned instances need per instance slices of the array instead of the whole list, write the full array to the system user param and pass the index through the data channel payload, then sample the array by index in particle spawn.
the Expose Niagara Variables C++ & Blueprints plugin is literally this gap filled: it exposes the array types stock leaves out (including mesh arrays) plus 18 variable types across all 8 niagara namespaces, setters and getters, in blueprint and c++, so the sync becomes one node on change: Expose Niagara Variables C++ & Blueprints | Fab