How to pass dynamic array from c++ code into custom HLSL node inside material?

I am making a space game where gravitational bodies are simulated in 2d plane (X,Y). I also want a plane that is placed beneath these gravity bodies and custom HLSL node will render the gravity effect for each of the body. Something like this Shader - Shadertoy BETA

Array should be dynamic, At any moment in runtime I should be able to add and remove bodies and same should be reflected inside the custom HLSL node.

I don’t want textures because what if I want to send more data than 4 floats (RGBA).

If there is a better approach please give any resources.