x

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"

Blueprint Array Remove Index/Item and Event Tick interaction bug

Hi,

Using 4.10.2, I've discovered that the blueprint nodes "Remove Item" and "Remove Index" for arrays of actors do not appear to function correctly when the array itself is iterated over in a event tick.

If you have an array of actors that are accessed and processed during an event tick, and then remove and destroy one actor in the array, you will receive errors in the PIE log after exiting, telling you the actor is still in the array and pending kill. If the array is not iterated over in the event tick, things seem to work normally.

I created a sample project with this bug: when the 2D example map is open and played, the player character creates a bunch of ledge actors which get added to an array that is iterated over in Event Tick. Pressing Q removes and destroys one actor, then closing the PIE will bring the errors in the logs to the fore. If the iteration in the Event Tick is removed, and instead pressing R is used to remove an actor, there is no problem.

I understand that this might be my error, and that in fact the Remove Item and Remove Index nodes do not remove the item or index immediately - however, I've not seen any documentation about this. Either way, bug or not, does anyone have any suggestions as to how to remove the actor from the array while still iterating? Or would the simplest solution be to halt the the processing in event tick for some amount of time (0.1 secs?) and resume once the actor has been removed and destroyed?

All help appreciated, and if this is a bug and more detail is needed, please ask!

Thanks.

Product Version: UE 4.10
Tags:
more ▼

asked Jan 28 '16 at 05:14 PM in Bug Reports

avatar image

MkII
143 15 16 27

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

1 answer: sort voted first

Hi MkII,

After testing this, all you need to add is an IsValid check before triggering the Custom Event in the platform blueprint. Since one of the platforms is destroyed and no longer valid, it causes errors if you attempt to activate the event.

alt text

Let me know if that works for you or not.

Cheers,

TJ

array01.png (55.9 kB)
more ▼

answered Jan 28 '16 at 07:18 PM

avatar image

TJ V ♦♦ STAFF
41.1k 1009 183 493

avatar image MkII Jan 28 '16 at 10:06 PM

That does indeed fix the problem, thanks! I'm still unsure why the array still contains the actor in this case, and I'll need to do some checking to see that the actor is indeed removed at some point - if you happen to know what exactly is going on here, please do let me know! I realise the actor is still around while it's being destroyed, but I expected the Remove Index node to immediately remove the actor from the array.

avatar image TJ V ♦♦ STAFF Jan 29 '16 at 03:08 PM

To completely remove it from the array you may need to resize the array after the platform is removed/destroyed.

avatar image MkII Jan 29 '16 at 06:26 PM

In the end I decided not to let anything remove and destroy the actor in the array, and instead let game objects add to a queue of actors to be destroyed. Then, at the end of the processing in event tick I can destroy and remove them safely in the actor that owns the array. This seems to work; next time I might try resizing as you suggest. Cheers!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
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