I am trying to make an ability in my game where you can spawn in three of an object and when you spawn in the forth, it automatically deletes the first, and so on and so forth. Currently, I am able to delete one. However, after I get the error “Blueprint Runtime Error: “Attempted to access BP_SpawnablePlatform_C_1 via property SpawnablePlatRef, but BP_SpawnablePlatform_C_1 is not valid (pending kill or garbage)”. Node: Destroy Actor Graph: Spawn Platform Function: Spawn Platform Blueprint: BP_FirstPersonCharacter”. I figure this is because the call to destroy actor does not know what to target but I was wondering if there is a way to fix this.
I am sorry. I am pretty new to unreal and have never used arrays. Could you explain how to do this? I made an object array and made 3 indexs with each one being a refrence to bP_spawnable platform, but I get the feeling this was incorrect.
you dont need to add index’s, just grab the array and use the add node.
the array should be of type actor so you can use the destroy actor node on it later.
encapsulate the pseudo code above to remove the first platform.
if you need more help show me your code so i know exactly where you are at
I’ve been working on it but don’t fully get it. I have to go to work so I’ll try later today or early tomorrow and get back to you. Sorry about all the delays.
So it seems to be working but I am getting the error: Blueprint Runtime Error: “Accessed None trying to read property CallFunc_Array_Get_Item”. Node: Destroy Actor Graph: EventGraph Function: Execute Ubergraph BP First Person Character Blueprint: BP_FirstPersonCharacter. I know it has to do with the fact that index 0 is empty at the start, but I am not sure how to fix it because everything seems to be working other than that. Here is the graph below: