AIVisualizer not rendering anymore

  • January 21, 2018 at 04:06 #22644
    Marcus
    Participant

    Hello ApexTeam,

    while working on refactoring some of my Agents i noticed that my AIVisualizers stopped working. As far as i can tell i have everything setup correctly and not changed anything related while refactoring.

    Setup:
    – One Agent has the corresponding AIs active
    – Gizmo/UI Visualizers are attached to a seperate GameObject and are enabled
    – Gizmos are enabled in UnityEditor
    -Gizmo Viualizers are set to All AIs or the specific one to render.
    – Gameobject is selected and the active AI is open in the editor window
    – The Unit has a ContextProviderComponent attached (IContextProvider implemented)

    What i did between woring and not working state:
    – refactor my Agent logic, which include Referencing IUtilityAIClients and switching them on/off
    – renaming my custom UnitFacade (which might be an issue, since it didn´t update some potential cached references in ApexMaps?!?)
    – Renaming some Actions including running the repair-process successfully.
    – Having the Agent start disabled and get enabled/setup during runtime… this includes switching on/off ai´s on demand. I tried to revert all of those changes currently to get the visualizers back working… no success.

    Situation:
    No GizmosVisualizer nor EditorAI Visualisaton is working anymore for my agents. The AI itself is working, since i placed some Debug.Logs which get triggert.

    Seems like my Visualizers have lost connection to the Agents/Context or assoziated ai.

    January 22, 2018 at 10:46 #22647
    Rami
    Keymaster

    Hi Marcus,

    Thanks for posting.

    My guess is that you are missing the GetAIClient delegate on the AIManager. Basically, you need to provide a way for Apex Utility AI to get ahold of the IUtilityAIClient through a game object. One example is like so:

    January 22, 2018 at 22:06 #22651
    Marcus
    Participant

    Hello Rami,

    thanks for your answer. I implemented the indeed missing delegate wondering if this will be the missing piece. Since i never had that delegate included and i had working visualizers beforehands i was wondering what of my changes would cause the need to implement the get-method in the first place.
    I´m also still using the Default UtilityAiComponent and you code implies that you might need that delegate if you replace that Component for some reason.
    So my implementation i tested looks like this:

    Unfortunally i still have no AI-Visualisation, but at least i recognized that i still have ApexPath visualisation working, but ONLY IF i select the Agent AND have the VisualisationComponent unfolded. If it´s folded i don´t see the pathvisualisation either (using the premade PathVisualizer from your codebase).
    I also tested hooking the AIGizmoVisualizer back the the Gameobject to get the Gizmos working again (hoping that it gets it´s AI clients by itself, when attached to the same GO, but it´s still not working.

    Any other idea what causes this issue, or did i do something wrong with the delegate implementation?

    January 25, 2018 at 10:11 #22662
    Rami
    Keymaster

    I apologize for not getting back to you, Marcus. Unfortunately we are super busy currently, and I am unsure why your implementation is not working.

    The delegate implementation is only needed when using custom UtilityAIComponents, which was my assumption in your case. Since you do not use that, AI visualization should work normally.

    The Path visualization is normal Unity Gizmos, so that follows normal Unity rules, including that the component must be expanded for Gizmos to run.

    It seems you have inadvertently changed something that broke visualization and unfortunately I cannot from your posts determine exactly what or why. If you have version control, perhaps you can identify exactly which changes you have made and try rolling them back until it works again?

    January 25, 2018 at 21:10 #22667
    Marcus
    Participant

    Hello Rami,

    i finally found the issue and it was the one obvious thing i forgot to mention (and to check) in my initial post: In the AI-Editor “Visualize” got unchecked for some reason, which obviously disabled editor-visualisation AND Gizmo/GUI visualizers.

    So if anyone else stumbles over this post having issues with visualisation, make sure to check this button too :)

    January 26, 2018 at 10:15 #22671
    Rami
    Keymaster

    Glad to hear you found the culprit.

You must be logged in to reply to this topic.