Download

Weird issue with tick event and cross-blueprint references

Hello guys! Just getting started with unreal recently and have been working on a small project with the puzzle template.

The problem is, I’m setting a variable of a child blueprint from a parent/manager blueprint. And the variable is set on project initiate (beginPlay) and it prints out its correct value on beginPlay. But when I print that variable on a tick event, calling tick event from the manager and then calling a custom event from the child which prints out the value of that variable, it prints out all 0 instead of the custom variable.

Here are the details:

In PuzzleBlock (child object) the Initiate event (called by the parent object when spawning this object) set PlayIndex to a certain value and it prints out its value (0,1,2,3…etc)

Then in PuzzleBlockGrid (parent/manager object), a tick event is sent out which is calling the **OnBeat **event from PuzzleBlock (child object)

Then in PuzzleBlock (child object) at **OnBeat **event, it prints out the value of PlayIndex (set before on initiate) and it became all 0. As if Initiate never happened…

When I print out PlayIndex on other event such as when clicking the child it works fine. I don’t understand why this specific event would cause this specific variable to be 0… The variable has no reference in any other places…

I can work around it by creating the whole ticker system on the child object and it works fine, but just curious about why/how this is a problem and wonder if that’s because of my lack of comprehension of how Unreal works…

So the block gets it’s play index from the grid on startup.

Why do you need to print it every tick?

Also, BTW, delay node on tick does nothing, have a think about it. Every frame you do this:

wait, print
wait, print
wait, print

which basically amounts to

wait, print
print
print

You’re also only getting one of the blocks, I’m assuming you have many.