Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Can't destroy actor that's in an array.

Hey everyone,

I'm trying to figure out why I can't destroy an actor that I've added to an array. In the Actor blueprint, I use the OnBeginPlay node to cast to the GameMode blueprint. From there I add it to an array that I've created in the GameMode blueprint [Image Attached].

In the GameMode blueprint I've got a custom event that I call from my Player character blueprint. It's supposed to destroy the first actor in the array. But I get an error that says it finds "Null". Even though it's added to the array. It can't find the first index for some reason? I'm hoping someone can help me out here! [Image Attached]

alt text

Product Version: UE 4.19
more ▼

asked Apr 21 '18 at 03:45 PM in Blueprint Scripting

avatar image

7 2 2 6

avatar image EvilCleric Apr 21 '18 at 03:53 PM

What exactly are you adding? The element to be added to the array is missing => nothing is been added => first element is null.

avatar image CelestialSatyr Apr 21 '18 at 04:02 PM

I'm adding an actor. Which is added on BeginPlay. I've tested it using a PrintString node: And it does actually add it to the array.

avatar image EvilCleric Apr 21 '18 at 04:06 PM

So, that adding operation is not in the images, yes?

avatar image EvilCleric Apr 21 '18 at 04:07 PM

Why aren't you using "Get"?

avatar image CelestialSatyr Apr 21 '18 at 04:17 PM

I've tried using the Get node from the array. But it gives me the same result: http://prntscr.com/j89uec And that adding operation is indeed not in the images. Here it is though: http://prntscr.com/j89uty

avatar image EvilCleric Apr 21 '18 at 04:25 PM

That's the same image as one of the above.

avatar image EvilCleric Apr 21 '18 at 04:31 PM

The "Add" node has 3 inputs: the execution pin, the array and the element to add. If you don't connect the third one, nothing will be added.

The above "Add" has nothing connected to the third pin, so what is the purpose of that node there?

avatar image CelestialSatyr Apr 21 '18 at 04:44 PM

That was indeed the problem. It appears I've disconnected that node when I was trying to figure it out myself. Cheers!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question