Why I can't make blueprint work from another blueprint?

Hello. I have 2 BP (day/night system bp and firepit bp). firepit bp has public variable “On?” which control state of firepit (fire on/off). I’m trying to set this variable to true in day/night bp, and it works, but in the game I don’t see any effect. I’ve tried to add more checking steps but it doesn’t help. For now I have this in day/night bp:


Array is not empty, cast isn’t failed, name of bp in print string node seems correct, get “on?” variable shows me the true so it should work.
And this is settings for firepit’s variable:
image
Seems like I miss absolutely obvious thing but I can’t find out what is it?

Can you show an image of what the Firepit On/Off behavior looks like? The issue might be there.

Sidenote your Cast To BP_Fire_01 is redundant in this case, as you’ve already established your casting to that class via the “Get All Actors of Class” node.

I know about casting, UE5 says it clear, just wanted to make sure.
Firepit is on:


Firepit is off:

And part of construction set of it:

If this behavior is only in the construction script you won’t see it in game. The construction script happens at the time of construction of an object (also in editor whenever an object is moved or a variable is changed).

If you want this to work try moving your code to an event that takes in an input of on off and have your time of day call that. Let me know if this works!

2 Likes

Hi @Texn0krat

The reason you have no effect is that a variable update alone will do nothing else in the target BP.

So unless youre checking your ON variable all the time nothing will happen.

Rather than keep checking the var, have a public function instead that has a boolean input for the ON. Inside this function run your code to DO whatever swicthing it on does and obviousley OFF also dont forget.

Then run the function from your other BP in the same way by dragging off from your get actor node.

Oh by the way there is a “Get Actor Of Class” (not actors) which will get the 1st actor it finds of the class you want. No need to use a seperate Get node. This may work here if theres only ever 1.

Edit: as @Mep_Joss mentioned a custom event would work here

1 Like

What should I do if I want to keep construction script? Can I synchronise it with custom event?

Well, I’ve added custom event with the same nodes and it works, thank you!

1 Like

I’m using “Get all actors” because I can have multiple firepits on level. Get node was used for debug, so I’ll remove it later. But anyway thank you!

1 Like

To keep the construction script and optimise move all the code to a function and allow the custom event and the construction script call the function, best of both worlds

You can keep your code in the a construction script and your event and everything will work as it should just fine.

Or you could consolidate everything to a single function and use that in both the construction script and the event.

Or tie everything to a bool that is buffered on tick and then instead of calling the function you change the bool from the time of day. That would look like:


image