set array stops updating at times

I made a door that can be updated from the editor with some different options.

My setup is basiclly:

  • door BP that i use as a template.
  • child BP from the template
  • an “empty” BP with a Child actor that gets an actor from an Array depending on the value from the door template. This contains the construction script that creates the actor.

sometimes it works perfectly but at times (and i havent found a repetable couse unfortunately) the array stops sending the right Actor.
I have a construction script in the Template that changes the location of the array actor depending on the same varible that creates them so i can see it changes location.

Sometimes, it stops sending actors all together.
Sometimes, it sticks to on actor that it has created but wont change (but it changes location)

Im not sure what to look for here so i hope someone can help out!

The integer i use as a varible goes from 0-2 and 0 is empty.


Looks like you dont have anything set on the set array element node there

0 in the array is empty so if I don’t want anything “extra” for the door it’s not getting an actor. Could it be the issue tho? Could I do it with a branch before so if 0=false
And do nothing?

That is exactly what you’d want to do, currently unless there’s more code not in the construction script your only setting child actor, and not actually changing anything in the array, at least from the bp screenshot provided, from the provided it’s always an empty array

To better see what’s going on, since construction always happens first in the event graph off of begin play do a for each loop and print out each element… if im right what you’ll see is the for each loop never runs it’ll just immediately goto completed and never run loop body

if this isint the case it’d be nice to see what else is going on in other parts related to the array

I might also add that it’s probably a better idea to change the doors static mesh rather than class

you could do this a couple of ways, with an integer or Enum is probably what i would do, with an Enum you can have a nice little drop down list and choose which door is it supposed to be

Using get all actors of class is not generally a good idea either, but in a construction script it’s not as hurtful as using it in other places, unless your spawning in doors as a buildable in which case it would get laggier the more doors you have

perhaps you have a reason your doing it this way, but ill leave this here in case not

Construction Parent:


Event Graph Parent:

Construction Child:

Hopefully this is roughly what you were going for

Looks exactly what im trying to do! THX!!
I ran into a different issue tho, when making lots of child BP from the door, and unlock one of them, it triggers every door to unlock. is there a way to assign a value to each child BP from the main BP or do i have to set every child up one by one as references?

If your using the get all actors of class, that would be why all doors open

Using an interface it should only trigger the one that its called on