Download

Basic ForEachLoop problem

I am following an FPS unreal video tutorial on ForEachLoops and I am trying to expand on the tutorial by calling in a variable from another blueprint. The target object is called BP_CubePickup. I was successful calling in the variable from PlayerCharacter but when I created a BP_PlayerController and called that variable, it complains about an accessed None from function error.

When the FirstPersonCharacter collides with the collision bounds of BP_CubePickup, it triggers the On Component Begin Overlap Event that calls the BP Player Controller Actor Class using “Get All Actors of Class” node and “GET” to target “PlyCntrlStringVar” Array that is located within BP_PlayerController so that an AddUnique can add the BP_CubePickup variable “CubePickupName” content to the PlyCntrlStringVar array for storage. When the FirstPersonCharacter exits the collision bounds of BP_CubePickup, the On Component End Overlap Event makes a call to PlyCntrlString for the contents of the array via a forEachLoppBreak node and compares that to the BP_CubePickup variable “matchValueString”. If there is a match, then it prints out “Done” if not, then it prints out “Wrong Name”.

Here is the Blueprint and the error message. Again, for some reason when I try calling in the variable from PlayerCharacter, it works. But when I make a call to the variable within BP_PlayerController I receive this forEachLoop error. I am sure it is something simple but I have tried looking at other forum answers and I can’t seem to get it to work. I double checked the variable names and classes but they seem correct.

Any advice would be appreciated.


LogScriptCore: Warning: Script Msg: Attempted to access index 0 from array ‘CallFunc_GetAllActorsOfClass_OutActors’ of length 0 in ‘/Game/FirstPersonBP/Blueprints/BP_CubePickup.BP_CubePickup_C:ExecuteUbergraph_BP_CubePickup’!

Blueprint Runtime Error: Accessed None trying to read property CallFunc_Array_Get_Item from function: ‘ExecuteUbergraph_BP_CubePickup’ from node: Branch in graph: ForEachLoopWithBreak in object: BP_CubePickup with description: Accessed None trying to read property CallFunc_Array_Get_Item

Blueprint Runtime Error: Accessed None from function: ‘ExecuteUbergraph_BP_CubePickup’ from node: Branch in graph: ForEachLoopWithBreak in object: BP_CubePickup with description: Accessed None