Defining the domain | AI Planner | 0.2.4-preview.3
docs.unity3d.com
    Show / Hide Table of Contents

    Defining the domain

    For the Planner to be able to solve a problem, a model that represents this problem need to be created first. This model is expressed using a trait-based domain language that can represent a large variety of scenarios. Traits are defined using the Traits package.

    To define a planning domain, two types of assets can be used: "Trait Definition" and "Enum Definition". These assets can be created via the asset creation menu (Create -> AI -> Semantic -> Trait or Enum Definition) or the Create menu from the project window.

    Image

    You can edit domain assets in the Unity inspector.

    Enumerations

    The trait-based domain language supports most basic data types, such as int, float, bool, and enum. For the latter, "Enum Definition" assets allow you to define custom enumerations to be used by properties in your domain's traits.

    Image

    Traits

    Traits are the fundamental data that represent your game/simulation. Each trait specifies a quality which objects can possess, such as the ability to be carried or to be used as a weapon. Traits are composed of properties which reflect attributes specific to each trait. For example, consider a trait "Cell" which marks objects in a Match3 game that are cells. Such a trait may possess a property "Type" (utilizing a CellType enumeration), which denotes the color of the cell. In this way, traits are defined by:

    • A name
    • A list of named properties with types and default values

    Image

    Generating Code

    Once your traits have been defined, you will need to generate code for the component and data representations. To trigger this step, use the build command from the Semantic menu (Semantic -> Traits -> Build).

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023