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.
  2. The 2022.2 beta is now available for testing. To find out what's new, have a look at our 2022.2 feature highlights.
    Dismiss Notice
  3. We are updating our Terms of Service for all Unity subscription plans, effective October 13, 2022, to create a more streamlined, user-friendly set of terms. Please review them here: unity.com/legal/terms-of-service.
    Dismiss Notice
  4. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice
  5. Join us on Thursday, September 29, for a day with Unity's SRP teams here on the forum or on Reddit, and discuss topics around URP, HDRP, and the Scriptable Render Pipeline in general.
    Dismiss Notice
Dismiss Notice
Submit bug reports tagged with #Beta2022Win_Unity when you encounter unknown issues while testing the 2022.2 betas for a chance to win a year of Unity Pro. For more information, have a look at our Beta Sweepstakes Announcement.

Question 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:
    42
    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:
    42
    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:
    42
    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:
    5
    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