On Build & Run GetPointsAroundPointWorld does not update list

Hello,

I’m using GetPointsAroundPointWorld to transform a list of vectors, based on a ray hit.

When I play the game from the unity editor, it works perfectly.
When I Build & Run the game, the list is always changed to 0,0,0.

Anything you can suggest? Code below:

Ray ray = Camera.main.ScreenPointToRay(mouseClick);
RaycastHit hit;

        if (Physics.Raycast(ray, out hit, float.PositiveInfinity, ground))
        {
            
            List<Vector3> current = selected.Select(u => u.destination.GetValue()).ToList();

            Pathfinding.PathUtilities.GetPointsAroundPointWorld(hit.point, AstarPath.active.data.recastGraph, current, 0, 0.75f * 2);

            for (int i = 0; i < selected.Count; i++)
            {
                selected[i].destination.SetValue(current[i]);
            }
        }

I’m on Version 4.2.17

Apologies, it might be something obvious that I have missed – as I have tried to move the character to the hit.point and even though the destination is being set, the navmesh is not being navigated when Build & Run is used.

It’s working now – I needed to enable Cache Start-up:

image

Will leave the post for further comment if required. Thanks

Hi

Most likely, an error was logged in the game about it not being able to generate the graph. This can happen if, for example, the meshes are not readable. You can check the player log file.