So I have this simple script:
The array contains actors; The actors are all from the same (blueprint) class. It’s just a few in the scene.
The blueprint class is called Blueprint_CellWall. The array is set to be editable, and exposed on spawn, so I set its contents from withing the editor window. Here’s another pic from the editor:
Does anyone know why I can’t manipulate it? If I print out their locations, it does it correctly…
I also get an error when I replace the destroy actor with a move actor node:
The best way to troubleshoot your issue would be to use “Breakpoints” to find what part of the code is firing and what isn’t. What I would do is attach a “Print String” to the “Is Not Valid” to see if that’s being fired.
I also notice that your “DoOnce” isn’t resetting, so it’s literally only ever firing once, But I haven’t had much experience with the “DoOnce” node.
Check out this documentation: Blueprint Debugging in Unreal Engine | Unreal Engine Documentation to find out where your code is firing.
Is no actor destroyed or only one?
I believe the timeline is run only once, not for every array item once.
It is valid: I’ve added a print string, and printed the location of both the items in the array. But they’re not being deleted :\
I reproduced your error. Gotta be honest, I’m not 100% sure why it wasn’t deleting, but I tried a different approach and got it to work.
First, forLoops keep shooting even if the first iteration hit a delay or timeline, so you probably don’t want that. Because a timeline can be used like a tick event that you can turn on and off, just keep checking the length of your array to see if it is 0. If it is, stop the looping timeline. (I put a delay on mine, I don’t know if you wanted a pause in between each one or not)
Make sure you remove the index of whatever you had just deleted. If you don’t it will only delete one and loop forever.
I was only using M pressed for testing.
So the code below contains what I need?
The code below does what you seem to be trying to do. I don’t know all of your code. The code I provided shows how to delete multiple actors using a timeline.The order in which they are deleted would be decided by the order you add the actors to the array.
Any changes are of course up to you. I’ve commented the differences I have made.
Haha, thanks so much!
You’re really helping me out! Do you know what I could do if instead of destroying the actor, I wanted to add actor world offset (where the delta value is driven by the timeline?)
Something like this maybe, but that actually works?
Well, if you do it like that, it’s just gonna keep adding offset forever unless you limit it.
This is kinda how it’d be:
It’d be better probably to use lerp and set actor location, such as:
This would do it one at a time, however, and doesn’t use the timeline value (that didn’t work for me). If you want to do it all at once you could make a function attached to the timeline that does all of that for each one. basically copy most of it, make a function out of it, and the inputs would be the actor from each index of the array.
If this answers your question, mark it as accepted after you try it out c;
Thanks for all your help,
It doesn’t seem to be moving :
When the code runs the items in the array wont’t move and so the if statement checking if the actor location is equal to the moveToLocation never becomes true.
EDIT: Forgot to mention, if you set the target for the move actor node to the self (AKA the blueprint that’s running with, it does work, and moves itself)