Search Unity

NavMesh doesnt work on Android in Asset Bundle

Discussion in 'Android' started by nsmith1024, Feb 23, 2020.

  1. nsmith1024

    nsmith1024

    Joined:
    Mar 18, 2014
    Posts:
    870
    Hello,

    I'm using Unity 2018.3 and I have an scene asset bundle i load from a server, this scene contains a terrain with a navmesh.

    When the asset bundle is loaded from the server, then i put a navmesh agent on it, it doesn't work, agent.NavMeshOwner is always null and agent.isOnNavMesh is always false, so the whole thing fails.

    Is there a way to force the navmesh agent to attach to the mesh? Or why doesnt it work?

    Thanks
     
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
    Do you see any errors in logcat?
     
  3. nsmith1024

    nsmith1024

    Joined:
    Mar 18, 2014
    Posts:
    870
    No error, but when i run it in the editor, i open the navmesh window, and i can see the NavMesh in the terrain shaded blue, so i dont know why it doesnt attach to it. Can you suggest something?

    Thanks
     
  4. JosephSutcliffe

    JosephSutcliffe

    Joined:
    Apr 9, 2018
    Posts:
    23
    I'm having a similar problem.

    In the Unity Editor, everything works perfectly. But when I load my scene (from an asset bundle) on android, the NavMeshAgents don't work. I connected the device to the Android Logcat and I got an error from my NavMeshAgents saying "SetDestination can only be called on an active agent that is on a NavMesh". It seems to work on IOS phones but not on Android.

    I am not using a terrain, my scene is one big model piece with a mesh collider. Collisions also dont seem to work when I load the scene from the bundle, my characters with rigidbodies fall as if they don't detect the ground nor the NavMesh.

    I found a temporal solution, if the scene is added to build settings and loaded normally, everything seems to work (Both collisions and NavMesh). But I shouldn't use this solution as I want to load the scene from the asset bundle.
     
  5. ferranases

    ferranases

    Joined:
    Feb 27, 2017
    Posts:
    11
    Any Solution for this?
     
    NikitaGusev likes this.
  6. NikitaGusev

    NikitaGusev

    Joined:
    Aug 30, 2020
    Posts:
    1
    I’m also looking forward to your options for solving this problem. I came across it while building for WebGL

    Some sources recommend minimizing Managed code stripping, but this does not help in my situation.
     
  7. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
    Try adding a dummy scene that uses NavMesh. If there is a stripping issue, have such scene in the build should prevent NavMesh from being stripped.