Hello, I have a question. Do you have the log file or know what crash exception you are getting? It’s possible we could see if something is happening with the loop or a null exception and go from there.
If the keymap is giving issues, then you could simply just get the current object in the array’s distance, save it and it’s current location to a local variable in that function if the distance value is lower (Let’s name them ClosestActor
and ClosestDistance
). Once the for loop is done, you then return those variable’s values. For the first case we can just check if out array index is 0 to set the ClosestDistance
.
I have an example of what that may look like as well.
Hope that helps!