Download

Adding a referance to Target Point inside Blueprint

Hello, I am trying to add a referance to a Target Point inside MotionController Blueprint of VirtualRealiytBP. I have several TargetPoints in my level each of them indicates a different place where I want to move my Actor. The problem is I cannot get an element with “0” index of Target Point Class (I have created the array in the level blueprint.

You’d need white execution wires in the Get All node to start with. Do note that GetAllActors does not guarantee the order of elements unlike an array that you created yourself.

I was wondering if there is a way to go through the results of GetAllActors (using a ForEachLoop) and get the element with a certain name?

You said it. Do a for loop on the returned array. On the other hand, if you absolutely *must *use GetAll for this, wouldn’t it be easier to give you targets *tags, *and get an actor with a specific tag. Saves you looping.

But perhaps you could describe what you’re trying to do in more detail. I’m under the impression there is a much easier, cleaner solution here.

How does the player actually select the point they’re going to? Is this a standard VR point to location and teleport thing, where the locations are fixed? In which case, the targets should have a collision box to which you trace and obtain their specific reference. There usually is no need for GetAll + Loop + Search by name spaghetti combos - it can be made work, sure, but is not too efficient.

Do tell!