I noticed a strange bug - some invisible collider on the A* Pathfinding gameobject. See attached video:
In the beginning, just for comparison, you can see that everything works fine… the effects of the weapon are shown correctly.
Marked in the hierarchy is the current level “World01_Room22”.
0:25 - I load a different level “World01_Main”, and deactivate the gameobject with the first level “World01_Room22” (caching that first level for later use).
0:40 - I disable the current level gameobject “World01_Main”, and activate the gameobject with the first level “World01_Room22”.
1:05 - the player passes said “invisible collider”, and from now on many of the effects are strangely “pulled towards outside of the collider” - basically towards the “last grounded position outside of that collider”.
1:27 - I cannot see any collider inside the scene view.
1:45 - I finally found out that when I remove the A* Pathfinding gameobject, that collider disappears and from then on everything works fine.
A* Pathfinding Version 4.3.83
I also tried 4.3.84 - same issues.
I forgot to mention that whenever I load a scene, or enable a cached “scene gameobject”, I do run this code as a coroutine:
public static IEnumerator ScanNavMeshs()
{
// wait for any running scans...
while (AstarPath.active.isScanning)
yield return Game.Coroutines.WaitForEndOfFrame;
// scan new level.
foreach (var progress in AstarPath.active.ScanAsync())
yield return Game.Coroutines.WaitForEndOfFrame;
}
There should be no difference. They literally call the same method.
Could you debug it by setting A* Inspector → Settings → Graph Coloring = Navmesh Border Obstacles?
Do you have multiple graphs in your scene? It looks like it.
Also. It’s really hard for me to tell where the invisible collider is supposed to be. I can’t exactly see your button presses, so I don’t know where your character can’t go.
Interesting… I tracked it down to a RichAI still being enabled on the PlayerController gameobject… I saw a blue line in the scene window (when I disabled all unneeded graphs ) …
A blue line going from the player … now I had to find out which script by disabling each running script manually (stupid Unity should have more search/multiselect to disable gizmos )
The player is using the RichAI whenever s/he enters or leaves a room, to find the “outside” position…
However, if I disable it when it is not needed, everything works fine…
Strange thing is, why the RichAI suddenly is pointing towards a “random point”, when it doesn’t do this in most of the scenes?!?
Anyway, I have a solution - disable unneeded RichAI