Download

help! something I don't understand

when I learning something about blueprints, there is one node teacher told me programming like this:


In this part, the only thing the function “Initialize Speaker Logic” can do is setting the value of an array:

but, if a program like this:

then, something when wrong. I don’t what happened and what the difference between these. So I think I need some help. TKX!

Is the speaker list array variable local to the function?

image

Nope, it’s just a variable. It seems that I can’t create a new variable and initialize it at the same time, or I need to turn it into a local variable?

Hm as far as I know there should be no difference?

I’ve tried it within a new project with some Actors and the Level Blueprint and it works without Promoting it to a variable. The function prints out a Print String for every BP_TestActor that was found.

What exactly isn’t working on your side?

"Blueprint runtime error: “Accessed None trying to read property Speaker_Logic_Reference”
Actually it’s a sample product provided by epic online learning platform. When I click an struct, it calls this:


and the function “Set Cabinet Material” references variable “Speaker List”.
it seems that the bp doesn’t create an variable to be called but i don’t know why did this happen

Not completely sure how your BP setup looks like, sorry :nerd_face:

Try to use some very basic debugging method: The Print String node. Print out some of the values you’re trying to get / set. For example the Array of Speaker BP’s or the (for me at least) very strange Cabinet Index. So you can pinpoint, when or where exactly your Blueprint fails.

Got it, thank u so much