Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question [AI Planner] Traits data accessing

Discussion in 'AI & Navigation Previews' started by gentmo, Nov 23, 2021.

  1. gentmo

    gentmo

    Joined:
    Aug 13, 2018
    Posts:
    5
    Hi, tried the AI Planner packages and get some understandings but more confused.

    From my understanding, traits are Components of Object/Entity, we can modify traits in action callbacks.However, when change traits through mono update, the changes are not seen by the planner. Is there anyway to let the planner know the changes?

    So how do we change traits that need to update every frame, for example, hp/mp regeneration? Using action callbacks to change this type of data seems incorrect.

    Thanks in advance
     
  2. gentmo

    gentmo

    Joined:
    Aug 13, 2018
    Posts:
    5
    After a little bit trying, I think I figured out.
    So it seems the DecisionController has its own data when planning, you need to set the "Next State Update" to world to sync the data with the world data(your mono data). Or you can call DecisionController.UpdateStateWithWorldQuery() at some point if you modified data want update decisionController planning data.