AI Planner version 0.2.4 released

Hello, everyone! Today we are releasing the Unity AI Planner version 0.2.4. In the past few months, our team has moved the trait language into its own package, Semantic Traits. With this change, we taking the first steps in enabling the integration of the trait language into other gameplay and authoring tools for Unity. The Unity AI Planner will continue to use traits, becoming the first of a suite of decision-making and agent control packages built on top of Traits. Highlights in this release:

  • Minimum Unity version is now 2020.1.2f
  • Entities dependency updated to version 0.16.0-preview.21
  • Support for list operators in ActionDefinitions
  • Added a “PlanningAgent” trait in planning states as a flag to identify the object representing the agent (“self”)
  • Text searching for state data in the plan visualizer
  • Planning jobs now allocate less temporary memory during execution
  • State conversions after world queries now allocate less managed memory
  • A new, experimental C# API has been made public, allowing for customized use of the planner modules

Sample projects: GitHub - Unity-Technologies/ai-planner-samples: AI Planner: Samples
Full docs: About AI Planner | AI Planner | 0.2.4-preview.3

Adding the AI Planner to your project
As you may know, beginning with Unity 2020.1, preview and experimental packages are no longer discoverable in the package manager. See here and here for more information. You will still be able to try out the latest releases of the AI Planner, but to do so, follow either of the methods for adding the package below:

Method 1:

In the package manager window, select the plus (+) sign at the top of the package list, then choose the option “Add package from git URL…”, entering “com.unity.ai.planner” as input. After a few seconds, the package will be downloaded and imported into your project.

6491945--729926--upload_2020-11-4_16-17-29.png

6491945--729929--upload_2020-11-4_16-17-55.png

Method 2:

Add this line to your manifest file of your project’s “Packages” directory:

"dependencies": {
"com.unity.ai.planner": "0.2.4-preview.3",
...

What’s next for the AI Planner?
Since September, our team has been taking a short hiatus from development on this package so that we may lend our time to the NavMesh team, to help improve stability and reduce user pain. Currently, we expect this effort to round out the remainder of 2020. In the meantime, we are laying out the future plans and feature roadmaps for next year. For 2021, we will focus on integrating the packages with other gameplay and authoring tools at Unity. Stay tuned!

14 Likes

bad luck with new version, throws me a “ObjectDisposedException: The Unity.Entities.EntityManager has been deallocated, it is not allowed to access it” error, seems related to semanticObject conversion issue?

2 Likes

Can you give us some context as to what you tried to do?

using Unity.Semantic.Traits; // no such lib?

var traitComponent = other.gameObject.GetComponent();

should be changed to I think
var traitComponent = other.gameObject.GetComponent();

am I wrong? where is the namespace for this?

Namespace Unity.Semantic.Traits is missing?
solved… must be added to assembly defs, but you cant pick it from the dropdown so I assumed that was not right… you must dragndrop to add to assembly

1 Like

just import AI.planner , and then add a trait on a gameobject, then play, nothing more. (2020.2.0b08)
during my test, also got some weird stuff like “operands compile error” ( can’t remember full err info) or cycling compile when click play button (then editor goes to crash)

1 Like

Ah. We haven’t tested on 2020.2 extensively. I’ll look into it.

i try to do simple test in unity(2020.2 b10)
the following error show :

Semantic Build:
Temp\PlannerAssembly\Generated.AI.Planner.Plans\NewProblemDefinition\PlannerSystemsProvider.cs(18,113): error CS0246: The type or namespace name ‘DefaultHeuristic’ could not be found (are you missing a using directive or an assembly reference?)
UnityEditor.EditorApplication:Internal_CallDelayFunctions ()

Assembly build finished for Temp\PlannerAssembly\Generated.AI.Planner.Plans.dll – Warnings: 0 - Errors: 1
UnityEditor.EditorApplication:Internal_CallDelayFunctions ()

Planner Build:

Temp\PlannerAssembly\Generated.AI.Planner.Plans\NewProblemDefinition\PlannerSystemsProvider.cs(18,113): error CS0246: The type or namespace name ‘DefaultHeuristic’ could not be found (are you missing a using directive or an assembly reference?)
UnityEditor.AI.Planner.CodeGen.PlannerAssemblyBuilder:Build () (at Library/PackageCache/com.unity.ai.planner@0.2.4-preview.2/Editor/CodeGen/PlannerAssemblyBuilder.cs:149)

Assembly build finished for Temp\PlannerAssembly\Generated.AI.Planner.Plans.dll – Warnings: 0 - Errors: 1
UnityEditor.AI.Planner.CodeGen.PlannerAssemblyBuilder:Build () (at Library/PackageCache/com.unity.ai.planner@0.2.4-preview.2/Editor/CodeGen/PlannerAssemblyBuilder.cs:149)

When Enter play mode:
Planner systems provider not found. Have you generated the code (AI->Planner->Build)?
UnityEngine.Debug:LogError (object)
Unity.AI.Planner.Controller.DecisionController:Initialize () (at Library/PackageCache/com.unity.ai.planner@0.2.4-preview.2/Runtime/Controller/DecisionController.cs:176)
Unity.AI.Planner.Controller.DecisionController/d__53:MoveNext () (at Library/PackageCache/com.unity.ai.planner@0.2.4-preview.2/Runtime/Controller/DecisionController.cs:284)
UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)

Decision Controller for object GameObject has not been initialized.
UnityEngine.Debug:LogWarning (object)
Unity.AI.Planner.Controller.DecisionController/d__53:MoveNext () (at Library/PackageCache/com.unity.ai.planner@0.2.4-preview.2/Runtime/Controller/DecisionController.cs:287)
UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)

We also discovered this error late last week. We’ll be releasing a fix soon.

1 Like

0.2.4-preview.3 is out. It contains a fix.

2 Likes

it works.

hi @TrevorUnity , there is an issue currently with the AIplanner(0.2.4) and the Enter Play mode Settings => Enter Play mode option(Experimental)(Unity 2020.1.4f1).
The way you are currently using the EntityManager doesn’t work if that settings is enabled
bug occurs when i press play


basically every trait in my scene throws this exception.
in order to reproduce all you need to do is the following:

  1. create a new project
  2. add aiPlanner
  3. create a trait definition
  4. create an action definition using that trait
  5. create a problem definition using the action
  6. build semantic
  7. build AI
  8. check the Enter Play mode Settings => Enter Play mode option(Experimental) in the project settings with reload domain and scene uncheck which was recomended by Joachim Ante on his post
  9. press play
    this play mode experimental settings is a real time saver i hope you can fix it

Dears,
Is there update regards sample projects.

1 Like

Yes please ! we want more info about the planner !

ETA for samples update? I want to start learning ai planner

The Location Moveable Navigate Is Old in 0.2.4.Preiview.3 Editor model.

And report some errors about Memory leak when end play.

Could you provide some information as to what tools are being considered here?

:slight_smile:

1 Like

@Onigiri https://github.com/Unity-Technologies/ai-planner-samples have you looked at these yet?

1 Like

I have been experiencing a null reference exception when trying AI → Build:

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.AI.Planner.CodeGen.CodeGenerator.IsListType (System.Type type) (at Library/PackageCache/com.unity.ai.planner@0.2.4-preview.3/Editor/CodeGen/CodeGenerator.cs:616)
UnityEditor.AI.Planner.CodeGen.CodeGenerator+<>c__DisplayClass11_0.<GenerateAction>b__3 (Unity.AI.Planner.Traits.Operation p) (at Library/PackageCache/com.unity.ai.planner@0.2.4-preview.3/Editor/CodeGen/CodeGenerator.cs:299)
System.Linq.Enumerable+WhereSelectListIterator`2[TSource,TResult].ToList () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
UnityEditor.AI.Planner.CodeGen.CodeGenerator.GenerateAction (Unity.AI.Planner.Traits.ActionDefinition action, System.String planName, System.Type[] customTypes, System.String outputPath, System.Boolean includeEnums) (at Library/PackageCache/com.unity.ai.planner@0.2.4-preview.3/Editor/CodeGen/CodeGenerator.cs:354)

Any idea why this might be occuring?

I also have two additional questions:

(1) I am planning on using this for a turn-based game rather than real time. Is it possible to use the AI planner in this sort of context? I.e. permitting the AI to only execute one step of a plan each turn?

(2) It is possible to write methods that will alter the traits of semantic objects when the human player takes actions?

:face_with_spiral_eyes:

Hi, everyone. Today we released 0.3.0-preview.2 and updated the samples to the latest version. The new version contains some fixes for crashes as well as a fix for the reported memory leak.

Samples: GitHub - Unity-Technologies/ai-planner-samples: AI Planner: Samples

3 Likes