I have encountered a behaviour with Do Once which I don’t understand and even though I can work around it, I would love to know what’s going on. Most probably it’s just me not understanding something really basic.
I have this setup:
- character BP that has all the functionality
- a child of the character BP that serves only to setup/overwrite specific variables
- animation BP that is being used by that child character BP
- from the animation BP I’m reading a value (“Trot2Run Threshold”) that is setup in the construction script of the original character BP (the parent), I’m doing this reading by casting from Anim BP to owning actor/character
- I’m storing this value in another variable (“Trot2Run Threshold ABP”) inside of the animation BP
The problem:
- if I store the variable via animation update event (every tick) all is fine
- as soon as I try to store the value only once via Do Once, the value is set to zero (I tried to do this as some sort of optimization because the value isn’t changing over time so it should be enough to set it only once)
Picture for clarification:
&stc=1The top version doesn’t work, always set’s "Trot2Run Treshold ABP to “0” (i guess it’s setting it specifically to 0 otherwise it would keep it’s fancy default value if it wouldn’t happen even once)
The bottom version works ok.
Would appreciate if someone could explain what I’m doing wrong or if I have wrong expectation of how this should work.
Thanks