Hi!
In this BP I spawn 9 BP_TileBase and set them a random material from the Materials array.
I’m also trying to set the CurrentMaterialName in each BP_TileBase which should be M_+integer received from Random Integer in Range (which corresponds the materials assets names).
The setting material part works but instead of every tile getting their corresponding name, they get a random name not depending on a material.
1 Like
It’s because you’re calling ‘random int in range’ twice. Once for the ‘set’ and once for the string.
It will work if you call it once, and put the result in a variable.
Yes, what you said + I messed up associating the Materials array elements with their names (forgot about element 0 - classic).
It’s working now, thanks.
1 Like
As of 5.5, you can also right click on pure nodes, like ‘Random in Range’, and select ‘Show Exec Pins’. This makes the pure node function the same as impure nodes which will effectively cache the value of the pin so that the node is not re-executed for each connection.
The difference can be minimal, though more relevant on the event graph since you can’t make local variables.
1 Like