Generally, if you add an ISM component to an actor manually, if you want to use PerInstanceCustomData, you need to set the “Num Custom Data Floats” property from the component’s detail panel in order to use them. i.e. If set to 2, PerInstanceCustomData[0] and PerInstanceCustomData[1] should work, but PerInstanceCustomData[2] would not.
However, how do you set the “Num Custom Data Floats” property when the ISM component has been added dynamically at runtime?
As far as I can tell there is no BP node for setting that. I have tried just assuming/hoping it would just work even without setting it, even though it doesn’t work like that using manually created ISM components.
First, it seemed like I was able to change the custom values just fine using the SetCustomDataValue node. Despite the ISMs being added at runtime with no “Num Custom Data Floats” property set, the material received the values just fine.
Then later, I was making a nearly identical system, but this one was a SceneComponent BP, which added the ISMs to the owner actor and then used them to do pretty much the same thing as the previous actor BP using the same material. Only, now the custom data was no longer working. Everything else seemed to work just fine, but no custom data. The material only receives a 0, always. Just like it does if an ISM component is created manually and the “Num Custom Data Floats” property is not set.
I’m confused as to why the actor BP worked and the component BP did not. I, of course, understand it might be hard to answer that last one unless I go through a longer explanation and share my blueprints, but if anyone can shed light on any of this I’d appreciate it.