Support Forum

Different result on PathUtilities.IsPathPossible Editor/Mobile

I have a gridGraph that occupies all the map.

Over it I build street tiles and every time I build a new tile I call this:

in order to keep the node in a collection, update the graph with the tile bounds, and then I trigger ‘StreetChanged’ that checks PathUtilities.IsPathPossible with all the nodes I currently have.

The result is as it follows:
When I build streets that are connected (all in the same area) nothing happens. IsPathPossible returns true.

And when I build streets that are NOT connected… IsPathPossible returns FALSE. See how it detects 2 different areas (different colors)
Captura de pantalla 2021-10-01 a las 17.17.32

And here is when it turns strange. When I build a street on water as you can see, on Editor it still detects that street in the same area (red). Which is good. IsPathPossible==true. Correct.
Captura de pantalla 2021-10-01 a las 17.18.55

But if I do this last operation… (Build on water) on device IsPathPossible returns false. Same operations same part of the map, same everything… it seems it detects another different area or I dont know what’s happening. Why it works well on editor and not in mobile?
I’ve read something about the static batching but neither im getting that in the log ( I understand should appear in console) nor the street prefab is marked as static.

Any hint of why could this be happening?

I think I got it… for some reason I dont remember, the water tile colliders are much taller than the other ones… And I had in the A* game object ray length 100… maybe on code this value set on editor is not being taken into account?

Captura de pantalla 2021-10-01 a las 18.47.10

By settings the values manually in code the problem was fixed. I created the object GraphCollision and added it to the graph at the initialization and now works on mobile…
I don’t know if its supposed to be like this or if there is some value that is not being taken from the A* game object with the graphs.

It would be nice to have an answer or clarification to this.
Thanks

Hi

I don’t know why it would return different results on mobile.
Maybe there’s some static batching step that only runs on mobile?
Does the same thing happen for other standalone builds too, or is it just mobile?

Didnt test on standalone build. But as I said it looks to me the configuration inside the A* game object (the Pathfinder component. Does not keep all the values in runtime if not in editor.
When I set the Collision testing and height testing by code all works fine in mobile.

That’s very odd. The exact same code for that runs in the editor and mobile.
Can you log what those settings are before you set them?

I think im not explaining myself.
This settings work on editor:
Captura de pantalla 2021-10-08 a las 19.01.31

But when it comes to mobile, If I dont specify the marked lines in code… It doesn’t work. On editor without the marked lines it does work.
Captura de pantalla 2021-10-08 a las 19.03.04

Thats why I’m saying that it looks like the editor takes all the values from the Hierarchy component (collisions testing and height testing setup) but on mobile it does not happen, you have to set them manually IN THE CODE.

That’s very strange.
When do you call IniteializeStreetsGraph?

Before generating the map and place the street tiles.

Would you mind saving the graph info (using the Save & Load tab) and sending that file to me?

But as I said, on editor I didn’t have any problem. Is still useful to you?

Yes. I think it’ll be useful for debugging.
It would also be useful if you could log what those collision settings are set to when you load the game on the iphone.

graph.txt (256.4 KB)

I had to change the extension from .bytes to .txt to upload it. I hope its useful.

The saved values in the graph seem to be exactly the same as the ones you set via code, so I’m not sure why it wouldn’t work. I’d be curious to know what values it logs being set before you set them via code.

In the log I sent you the code was enabled.
Should I comment the mentioned code lines and send the log again?

But still, any graph made with the editor will always be the same as the one I set via code. As I said, its like the graph in the editor takes the values from the A* game object correctly, but that doesn’t happen on the device.
Also I insist, after adding those lines in the code, the graph works well also in the device. If we could export the graph log from the device without the initialization code lines we would know if the graph is being created differently on the device.

You can export it from the device using AstarPath.active.data.SerializeGraphs. See Documentation