Search Unity

  1. The 2021.2 beta is now available. To find out what's new, have a look at our 2021.2 beta blog post.
    Dismiss Notice
  2. How can our website serve you better? Give us your feedback. Take our survey and let us know.
    Dismiss Notice

Help Wanted AI Planner 0.3.0-preview.3 - Unable to add RewardModifier

Discussion in 'AI & Navigation Previews' started by unity-freestyle, Feb 26, 2021.

  1. unity-freestyle

    unity-freestyle

    Joined:
    Aug 26, 2015
    Posts:
    26
    Hello there,

    I'm learning the AI Planner package and following some tutorials.

    However, I can't add new RewardModifiers to the list.

    The builtin asset is not compiling the LocationDistance, for example.

    But it works in the Tactics example...

    Using Unity 2020.2.6f1 and Entities 0.17.0-preview.41.

    Also upgraded the Tactics example with the same versions and it still works there.

    Anyone knows what the problem may be?

    Thanks!
     

    Attached Files:

  2. unity-freestyle

    unity-freestyle

    Joined:
    Aug 26, 2015
    Posts:
    26
    After creating an empty problem definition, building the planner and reimporting all the problem went away...
     
  3. unity-freestyle

    unity-freestyle

    Joined:
    Aug 26, 2015
    Posts:
    26
    The problem happened again, and when trying to build, this was the error message:

    Seems like the code was not generated correctly:

    Code (CSharp):
    1. namespace Generated.AI.Planner.StateRepresentation
    2. {
    3.     [Serializable]
    4.     public struct Location : ITrait, IBufferElementData, IEquatable<Location>
    5.     {
    6.         public const string FieldPosition = "Position";
    7.         public const string FieldForward = "Forward";
    8.         public const string FieldTransform = "Transform";
    9.         public Unity.Mathematics.float3 Position;
    10.         public Unity.Mathematics.float3 Forward;
    11.         public  Transform;
    12.         ...
    13. }
    Changing to
    public Transform Transform;
    made it work again, but only after setting the AI Planner as embedded package and reimporting all.

    Not satisfied, because I was certain it was working when installed from the registry, I've removed the embedded package and reinstalled from the registry, deleted all the generated assets and cache, reimported all, reopened Unity, and it worked again.
     
  4. rdcm

    rdcm

    Joined:
    Jan 9, 2017
    Posts:
    1
    The same issue for me, I have compilation errors while using 0.3.0-preview.3:


    Temp/PlannerAssembly/Generated.AI.Planner.StateRepresentation/Traits/Location.cs(18,26): error CS1519: Invalid token ';' in class, struct, or interface member declaration
    UnityEditor.EditorApplication:Internal_PlayModeStateChanged (UnityEditor.PlayModeStateChange)

    Temp/PlannerAssembly/Generated.AI.Planner.StateRepresentation/Traits/Location.cs(31,34): error CS1525: Invalid expression term ')'
    UnityEditor.EditorApplication:Internal_PlayModeStateChanged (UnityEditor.PlayModeStateChange)


    Temp/PlannerAssembly/Generated.AI.Planner.StateRepresentation/Traits/Location.cs(31,35): error CS1002: ; expected
    UnityEditor.EditorApplication:Internal_PlayModeStateChanged (UnityEditor.PlayModeStateChange)

     
unityunity