Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

Help Wanted AI Planner - Can we know when a termination is reached

Discussion in 'AI & Navigation Previews' started by Noxalus, Nov 16, 2020.

  1. Noxalus

    Noxalus

    Joined:
    Jan 9, 2018
    Posts:
    76
    Hello everyone!

    For my agents, I used to have "bad" actions (like PassOut) that must be done by the agent if some criterias are matched (like Energy = 0), making sure (using preconditions) that no other action is possible in these cases.

    But now, I use terminations for that as it's more suitable for me.

    The problem is when a termination is reached, I don't know how to check which termination is it, so I can't call the game logic code that correspond to this termination.

    I've looked at the new API, but I didn't find anything to have this information.

    Did I miss something?

    Thanks in advance for your help.
     
  2. vx4

    vx4

    Joined:
    Dec 11, 2012
    Posts:
    146
    Maybe you can use custom TerminationPrecondition. to imp terminations condition and set globel variable indcateing which terminations condition are reached.
     
  3. Noxalus

    Noxalus

    Joined:
    Jan 9, 2018
    Posts:
    76
    Hello @vx4 and thank you for your answer!

    Using termination precondition can't work for me as the planner calls this code long before the situation actually occurs (as it plans in advance).

    Moreover, custom code files must be in the AI.Planner.Custom assembly to be seen by the actions in the inspector, which limits a lot what we can do, and to be honest, I don't even know how I can access to my game code from custom precondition for now :/
     
    vx4 likes this.
unityunity