Download

Convert string to variable objects

Hello,

I’m attempting to convert an array of strings into variables used by other nodes.

For instance, I have an array of strings that I append in one blueprint based on several parameters then pass that to another blueprint. In this one I’d like to go through the array and use those values to assign materials or static mesh componenets. So the strings are the names of materials I’m using. Is there a way to do this? I can’t find a way to convert the strings.

Well, strings are in no way compatible with materials, so there really aren’t any efficient ways to do that. Something you could do is switch on string, and set the material based on that. If I may ask, what else are you using the array of strings for? Is it possible you could just use an array of materials?

I plan on using the array of strings to set a material of a static mesh component. Pulling the name of the static mesh object from the string and the material interface reference from the string.

I build up the strings in the array based on several paramters:

IF 1 THEN append index 1 “string_” + “1”, etc.

So an item in my array may contain something like “string_1_BB_material4”.
The material could be named “string_1_BB_material4” and the static mesh object could be “string_1_BB”

So using that I create a loop and assign the materials to each static mesh object.

Well, this is possible, but the only way I know of is to loop through every material, and compare it’s display name/object name with that part of the string, which isn’t necessarily wise as far as performance goes.

Hmm, this seems something like this would be useful in several scenarios. Perhaps, there is another method I am unaware of?

this is possible in c++ but have they added to noodle script yet?