Quick way to find an Index of a single data type in a Structure array? BLUEPRINT
I have an array with the structure type below. Let’s say this array is called ActorInfo…
Creating the structure and adding it to the array is easy enough but later on when I must remove it the path isn’t so obvious.
I can compare to the ActorObject data but the Location data would of changed.
For example: My actor is still the same actor, but the location in which it resides is no longer.
I’m having difficulties understanding how to find the index in my array in which to remove.
I ran through the Array of my structure and broke each structure where the Vector and Actor were present as expected.
However, I could not find a way to compare if Actor in structure was the same as Actor triggering the event.
I’m also concerned about if this is the quickest way as opposed to something similar to LINQ.
Keep in mind I’m using blueprints.
Thre is a “find” node that returns the index of a variable or structure in an array if you want to find the exact item (all entries equal). But if you want to find the index of the structure that matches only one entry (let’s say the actor is the same but other variables are different), than you need to run a for loop and check if the entry matches your search criteria.
If this is overwhelming for you, i can post some blueprint screenshots.
Hello, I can run the loop and break the structure fine but the single variable I need to compare is an actor and I’m not sure how you can compare actors in blueprints.
Basically what I am doing is when a collider hits an actor the actors location and reference is stored in an array under a structure.
While the actor is within the collider it becomes active and moves about.
Once out of the collider the actor is reset to it’s normal location but since the Location portion is different I can’t use that as a reference to find in array, and I don’t see an option to compare/find actors.
I could add a blueprint to the actor but there is no advanced logic behind them. I just adjust their location on the screen using the colliding blueprint.
Bump, anyone know how to go about this?
Ok, I’m confused because you can compare actors to see if they are the same jut as you would compare two integers.
I couldn’t find the node for it. I tried typing a couple different things.
I’m not at my computer now but I definitely tried using = before to try and find an actor comparison node but couldn’t. Fairly sure I turned off context sensitive as well. Could I please get the full name of the node?
It’s just there when you type “=”:
Ah, object not actor. That makes sense. I’ll try once home, thank you.
Cheers, let me know if it doesn’t work.
That did the trick. Marked as answered. Ty