Author Topic: NavMeshAgent stop working if an prefab is created with TNManager.Create  (Read 8959 times)

Willie Prinsloo

  • Guest
Hi All

For some reason NavMesgAgent fails with following message if I initiate my prefab with TNManager.Create:

"SetDestination" can only be called on an active agent that has been placed on a NavMesh.
UnityEngine.NavMeshAgent:set_destination(Vector3)
AITankController:goToDest() (at Assets/Scripts/AI/AITankController.cs:82)
AITankController:Update() (at Assets/Scripts/AI/AITankController.cs:56)

NavMesgAgent works fine with unity networking or without networking.





ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Has it been placed on a nav mesh by the time you get the Update? Chances are you're missing some RFC call at that point. Just debug your order of function calls.

Willie Prinsloo

  • Guest
I'm using a Nav Mesh Agent component that's attached.

At the Start() method I get a reference to the attached Nav Mesh Agent component:

agent = GetComponent<NavMeshAgent>();

I also tried to get the reference at the Update method.

AS per my pervious post this is working 100% on unity networking.


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Your error happens in Update. Verify that it happens after your Start(). Unity's networking is different.

Willie Prinsloo

  • Guest
I did try to use "agent = GetComponent<NavMeshAgent>();"  in the update() method.

It's still failing. It might be a good idea for Tasharen to test this with their framework.

Willie Prinsloo

  • Guest
Did anybody test this on TNet?

It's an important unity Framework....

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
If you send me a repro case, I'll have a look at it: support at tasharen.com