I’m not sure if it’s that they’re not working or something else is going on but I’ve spent days on this problem. Basically I am saving variables to a struct (and I was informed that materials can’t save, so I’ve been saving an integer with the number I need in reference to the material from an array). I had a similar question but it was solved, unfortunately I broke it again trying to get save systems working. It’s now acting a bit stranger.
So I have a creature that is a 2d image (made into a set of materials) and an actor the is a bunch of planes with the materials of the creature set up 0.01 units separated to create a sort of layered look. The creature has markings that can change, randomizing upon spawn. That’s all working. I made a duplicate of this actor only creating dynamic materials in it, and plan to use this one to spawn in and take from the struct created upon capturing the randomized creature.
I had it working when I was only saving and taking from the struct in the same instance, but I was saving materials directly to the struct. Once I moved to a new map or reloaded the save, the materials would be empty. So I had to switch to using integers to reference specific markings in the array.
Now the problem. I have debugged with print strings, and the markings (and marking colours) generated, markings/colours saved in the struct, and markings/colours being sent to ‘set materials’ and ‘set vector parameter’ are all the same. Yet when I create the new creature with this information, it seems to be randomizing both colour and marking. (Yes, material arrays are identical between the randomized actor and spawned actor)
Here’s an example of making the dynamic materials for the markings:
And the dynamic materials for the base colours where the materials don’t change:
And I’m SO sorry in advanced for the absolute mess this is, I don’t want to bother cleaning it up till it’s working. Here’s the start of where I’m setting my materials (inside my main actor upon interacting with a specific space) (The custom events being called are the ones inside the second actor to create the dynamic materials) The second image is just a continuation on the right of the first.
(The target for the vectors are connected to the dynamic material variables in the first bit)
The struct is not a problem it’s saving and performing properly, I checked with print strings. I’m assuming I’m doing something wrong with the materials but I can’t figure out what?
Thanks in advance!