Sharing an array value between a non character blueprint and the first person projectile BP?

Most of the tutorials I found are around sharing variables between BPs involve event hit or event overlaps which don’t apply to my scenario so I’m a bit confused on how to accomplish this.

I’ve got a basic actor blueprint that sits in the level that has an float array that updates every tick. I’d like to send values from that array to modulate the size of the projectile that a character shoots in the first person blueprint example.

How would this be done best? Event dispatchers? Casting?

Ask: How can I pull a value from the array on BP A to change the size of BP B’s projectile object when it is spawned?

How would this be done best? Event
dispatchers? Casting?

Both are useful here. You could ask an actor in the Level to obtain a reference to the first person character like so:

Rather than casting on Tick (which is too expensive to justify here), cast once, obtain the reference, store and use it. The player character has a custom event that accepts float array.


An Event Dispatcher has the advantage of not having to create a direct reference:


How can I pull a value from the array
on BP A to change the size of BP B’s
projectile object when it is spawned?

Assuming it’s the Player Character that spawns the projectiles.

The easiest way to do it is to have a float Exposed on Spawn on the projectile blueprint, this will show an extra pin on the Spawn node - you could pipe the data in here; the data that the level actor updated in the Player Character.

Not sure why this is an array but that boils down to how you envisioned it, most likely. Also, does need to be updated every frame?

Check out video #25 in the link below, I go over a few ways to create “references” which is what you will need in this case to get values from your blueprint with the array into the player character.

Everynone has a good suggestion to expose a variable for scale on the projectile at spawn in the player character and also have a variable in the player character that holds the value of the current projectile size so this will be plugged into the exposed pin on spawn. The blueprint with the array could easily grab a reference to the player character through a cast and update the projectile size variable within the player. So the flow would be:

Player Character → Vector Variable (MyProjectileSize)

ProjectileBP → Vector Variable (Size) Exposed On Spawn

Player Character → Spawns Projectile with pin exposed for a vector input

MyProjectileSize = Size (when exposed on spawn)

Projectile → Begin Play → Set Static Mesh Scale = Size

Array BP → Cast To PlayerCharacter → Set “MyProjectileSize” = ArrayValue

Thank you so much both of you, I’ll give your feedback a go later tonight and report back.

Not sure why this is an array but that boils down to how you envisioned it, most likely. Also, does need to be updated every frame?

The array holds values of the current playing audio’s amplitude that is playing which is generated from a music visualizer plugin, each index is a separate band so it needs to be updated frequently. I’d like to expand the blue print communication to also push BPM and Spectrum data to other objects so hopefully I can come up with a class that can be templated.

It’s working!! Thank you so much! It was a little tricky to figure out how to get the value to show up in the Event drop down from the blue print but I got it. Trick is to create an event dispatcher in the other blueprint and create an event off of that with an input that is of the same type.

It was a little tricky to figure out
how to get the value to show up in the
Event drop down from the blue print
but I got it. Trick is to create an
event dispatcher in the other
blueprint and create an event off of
that with an input that is of the same
type.

Yup, precisely! I should have mentioned it; here’s a bit more detailed explanation in case someone else stumbles upon it.

Good luck with the rest.