Setting from Struct not (entirely) working

with your screenshot here there is AN issue but not THE issue, you need to Set the PrimaryRBG before setting the vector param with the PrimaryRBG .

the reason being is youre calling the random floats twice so you’ll get 2 different random values.

Going back to the issue. it could be your ‘defaults’ override your ‘load’, again it all depends on order. you want to clearly separate your BeginPlay/Load

in your first post, all the stuff post spawn should (probably its hard to read) be inside the actor

im off to bed but your can debug your colors with a printstring to at least ensure they are saved/loaded.

you can also encapsulate all the material logic inside a function and print when its called to see whats happening.

good luck

As far as I understand it, the vector is getting one set of colour codes, the two random floats are multiplying together and then going to the float. So that should be fine as far as I know! (I’m doing this elsewhere and it’s working)

As for the main issue, you’re definitely right on that it is likely overriding things. I’m just not sure why because I am doing the exact same thing elsewhere and it’s working fine, this is just the only part that’s saved/loaded that’s causing an issue.

And it is in fact all in my main actor yep. Just calling references to other things as needed.

I’ll try the debug suggestion and see if that clears anything up. Not sure why I didn’t think of that in the first place, thanks!

Have a good night!

Edit

Okay progress:
Debugging has shown me the saved colour is randomized, or at least it’s re-randomizing the save colour before saving. It is not saving the proper colour. I ‘caught’ a light blue primary creature and when I ‘loaded’ it, the saved colour was purple. So it’s not randomizing the primary/secondary/eyes upon spawning it’s pulling successfully from the saved colour but the colour saving is wrong.

Still can’t figure out how it’s wrong though. I’m using the same code for the markings which is working fine.

Edit 2
More debugging!
I managed to figure out that the colour codes are the same for the one I capture vs the one I spawn. I printed the codes in two different colours and paid attention to which I caught, and the codes were the same. So it’s saving correctly, but overwriting it somehow upon spawning the ‘caught’ creature.

Figured this required a new post because I figured it out. Turns out I had to add the Dynamic Materials I made in the original randomized actor to the struct, then set the Materials for those three as well as the markings using the struct before setting the colours. If anyone can explain to me the exact reason why that’d be real helpful but hey at least it’s solved.

Thanks for the help everyone!

2 Likes

glad you got it working

i can assure you this IS a problem you just havent noticed it yet and maybe it doesnt matter since its random but its a good learning experience. RandomNodes are PureNodes so each call generates a different number. therefore your ParamColor and PrimaryRBG Color will be different. Again you can test this with a print string, have one random node and 2 prints strings and you’ll get different results.

i’d have to see the full context of your code so if you have further problems feel free to post it but for now its all good :slight_smile: