Accessed None trying to read property CallFunc_Array_Get

Hi. I’m would like to randomize the way how PaperFlipBook objects appear/or change color when the player hit them by mouse line trace. However, when I create an array in blueprints, I get this error:

It is random when it actually appears, but it prevents me from getting a specific item from an array and make it visible/invisible or change its color. Can you help me and tell me what is wrong with it? Here is a screen of this parts where the error appears. (It’s happening when I try to set a different color. )

Additionally, I will say that giving -1 integer does not work.

Does it happen every time you call this function or just sometimes?

Length - 1 is what actually should be done, because your array length is 10, but the final index is 9. Even if that’s not the case here, go ahead and do that.

Next, are all those Hit Key variables have values in them? Because if any of them is Null, you will get the same error even if the array index exists, but the element is actually Null. You should double check them. Actually, you can simply create an array in the BP and fill it with actors manually, and not use the Create Array node.

Hi, thank you for your answer.

I was thinking about length -1 and I tried it before, however, it seems it doesn’t help as well.

Hit keys are null on the editor, but they are set at the beginning of the play with tick. They are basically paper flipbook objects with a model in them.

Although, I could not add them manually to the array. How could I do it in the editor?

I can’t choose any from the list.

There should be a little “+” in the Default Value under the Details when you select the array.

Do you say that those 10 variables are updated every tick?

You can check if the array element Is Valid before trying to do something with it. And, maybe, if it’s not valid, you can run the function again; it will select another element which may be valid.

But that’s just a workaround; you should figure out why some of the elements are null when they are referenced. You should double check the function where values are assigned to them.