Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

[RELEASED] Emerald AI 2.4 - The Ultimate Universal AAA Quality AI Solution

Discussion in 'Assets and Asset Store' started by BHS, Jun 26, 2015.

  1. DanBanner

    DanBanner

    Joined:
    Dec 11, 2015
    Posts:
    29
    You misunderstand. I want AI to attack each other. For example I have a Wolf AI that I want to attack a Cow AI and kill it. I also want the player to be able to attack the Cow and earn experience, I use the On Death event to add experience to the player.
    The problem is that when the Wolf kills the Cow, the On Death event triggers and the Player earns experience which shouldn't happen.
    Any ideas?
     
  2. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,816
    I looked a this and I see that the OnDeath doesn't pass any parameters so there is no way to directly tell who killed the cow in your example. However, it's possible to make that determination with a little extra work. Here is a script that I wrote that you can attach to an Emerald_AI agent for determining if a player attacked the cow.

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class AIEvents : MonoBehaviour
    6. {
    7.     private Emerald_AI _emeraldAI;
    8.     private bool playerAttackedMe = false;
    9.  
    10.     private void Awake()
    11.     {
    12.         _emeraldAI = GetComponent<Emerald_AI>();
    13.     } // Awake();
    14.  
    15.     public void OnDeath()
    16.     {
    17.         if (playerAttackedMe)
    18.         {
    19.             // TODO: Award experience points here
    20.             Debug.Log("OnDeath()");
    21.         }
    22.         playerAttackedMe = false;  // reset in case this object is re-used in an object pool
    23.     } // OnDeath()
    24.  
    25.     public void OnDamaged()
    26.     {
    27.         if (_emeraldAI.DamageInitiator == Emerald_AI.TargetType.Player)
    28.             playerAttackedMe = true;
    29.     } // OnDamaged()
    30. } // class AIEvents()
    31.  
    This requires some additional code added in the Emerald_AI class as well as follows:

    First at the top of he script

    Code (CSharp):
    1.     public TargetType DamageInitiator { get { return damageInitiator; } }
    2.     private TargetType damageInitiator;
    3.  
    Then in Damage function:

    Code (CSharp):
    1.     public void Damage (int DamageAmount, TargetType TypeOfTarget){
    2.  
    3.         damageInitiator = TypeOfTarget;
    4.  
    5.  
    Once you attach this script to your AI, you'll have to add references to the Death and Damage events.

    [EDIT]
    You could make this smarter by adding a damage queue to Emerald_AI and you could push a struct onto the Queue that contains the amount of damage and the target of the attack. In the OnDamaged function you could then just check the target type by popping from the queue. You could also compare the amount of damage caused by the player to the AI's max health to see if the Player was the primary person responsible for the AI's death. That would help in the event that the player and a wolf were attacking the cow and the player would then only get experience if it did the majority of damage.
     
    Last edited: Sep 17, 2018
    BHS and Weblox like this.
  3. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    247
    When you guys have the script finalized could you maybe share it?

    I can see having some use for this in the near future..

    Thank you
     
  4. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,816
    You mean the script I posted as an example?
     
    zKici likes this.
  5. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    247
    Yessir,

    But fully without it being in parts (sorry not a good programmer...)
     
  6. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,816
    I wasn't planning on finishing it. Sorry. It was just a quick and dirty example. But maybe the person who needed it might finish it up and provide a final solution.
     
  7. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    247
    No worries - Thank you

    And lets hope so :)
     
  8. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,816
    Ideally, the asset author would provide events that can take parameters and then all the information needed could be passed to the event functions. That takes a little more re-work than my sample so that's why I didn't take that approach.
     
  9. PixelPounder

    PixelPounder

    Joined:
    Feb 11, 2014
    Posts:
    55
    With Opsive essentially replacing UFPS and the Third Person Controller that they have out now with their new Ultimate Character Controller... do you have any plans on coming out with an integration for it? I realize it just came out... just curious if this is in your pipeline of things to do... if so, when? Thanks.
     
    Duffer123 likes this.
  10. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    984
    BHS seems to have been afk for while?!
     
  11. DanBanner

    DanBanner

    Joined:
    Dec 11, 2015
    Posts:
    29
    I'll be working on it this week and once I have it working I'll let you know! I'll be happy to share it.
     
    zKici likes this.
  12. DanBanner

    DanBanner

    Joined:
    Dec 11, 2015
    Posts:
    29
    Thank you Magique for that code example, it has put me on the right track. This is why I love this community! Thanks again.
     
    magique likes this.
  13. Cartoon-Mania

    Cartoon-Mania

    Joined:
    Mar 23, 2015
    Posts:
    310
    Any news about the new version?
     
  14. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,060
    @BHS ,

    Just to mention that Opsive's Ultimate Character Controller and TPC2 are up on the Asset store and Opsive's website has an Integrations section ready for your Integration .. ;). Also, TPC has been deprecated...
     
    Mark_01, BHS and PixelPounder like this.
  15. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    984
    Is Emerald AI still being supported? I haven't seen anything from BHS lately?
     
  16. DanBanner

    DanBanner

    Joined:
    Dec 11, 2015
    Posts:
    29
    Last message was a couple of weeks ago, I assumed it was vacation time.
     
  17. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    984
    Same thing was said about the Aquas dev and ICE Creature Controller dev. Now both of them are gone.
     
  18. DanBanner

    DanBanner

    Joined:
    Dec 11, 2015
    Posts:
    29
    I'm keeping myfingers crossed!
     
  19. PixelPounder

    PixelPounder

    Joined:
    Feb 11, 2014
    Posts:
    55
    Quick question on companions: In the docs it says, "Companion - Will follow around their follow target and attack anything within their target tag list. Companion AI do not use the Confidence system."

    Is there a way where you can set it so it only attacks if you send it to attack? You may not always want it to attack automatically because you're planning an ambush or you're trying to be stealthy. I guess one way to do it is when you select/mouse click/put your aiming reticle and push a button (for joystick games) on something, it adds that target's tag to the target tag list and then I assume it would then attack it? Is that possible?

    Also, I assume companions can take on damage and be killed?
     
  20. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,816
    I remember in the sample video it demonstrates a case where the companion will only attack things that you attack so that they won't blow an ambush or expose you when you're trying to sneak around. I can't remember what the setting was though, but the video mentions it.
     
  21. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,212
    Hey everyone!

    Emerald AI, along with my other systems, are all very much alive. My apologies for not being as active on the forums as I should be. I’m very invested in my systems and that’s what’s been keeping me so busy.

    I will respond to each one of your posts soon and I will try my hardest to check for new posts daily.
     
  22. DanBanner

    DanBanner

    Joined:
    Dec 11, 2015
    Posts:
    29
    YAY! I never doubted you for a second!
     
    BHS and Duffer123 like this.
  23. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    247
    Updates cannot come soon enough, been waiting on it like cold Water in the middle of a hot desert.
     
    Duffer123 and SickaGamer like this.
  24. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,212
    You're welcome. Yes, I can certainly fix it. It's been added to the list.


    Oops, that's because that variable is private. I will make it public with the next update along with some new API to update an AI's wandering position.



    That's odd, the AI should be stopping consistently. If your AI's NavMesh radius is high, this is another thing that can affect stopping distance. I will look into this though. Are you referring to Unity's Debug Mode? This can be set by doing the following:
    DebugModeUnity.png


    I will look into this after I have finished the next Emerald AI update.


    Thanks, I'll take a look.


    Good, I will do a status update within the next couple of days with more details.


    Hey there and great to hear. :)


    With an external script, I would say it's possible. You would have to have colliders that the UFPS bullet component hits instead of Emerald AI directly. Each object could receive the damage done by UFPS's bullet and multiply it based on a variable stored within the body object.


    The rotation for particles is set based off of what it should be. If you're having issues with rotations, you can:

    1) Store your particle effects in an empty gameobject and set the particle effects as the child and adjusting the rotations as needed.
    2) Adjust the rotations for the particle effect with the Particle System using the Shape section.

    The animations and models that come with the pack are just for demonstration purposes. Setting up animations to be used with projectiles is the same as setting them up for melee combat except you use the Attack Delay to time when the projectile fires. If you're looking for free high quality animations, you can use www.mixamo.com. You can get the same animations and models that were used in some of Emerald AI's demo videos.


    Strange, I just tested this with the same version of Unity as you and everything looks as it should. I have a 28 inch monitor and I'm not experiencing this issue. I have no idea why it wouldn't be scaling correctly. I will try to see if I can recreate it though.

    EditorSize.png

    If you're having inconsistencies with AI detection, it's usually because of an AI's raycast detection. This is usually happens when the AI's Box Collider that Emerald AI automatically applies is too small making other AI unable to detect them as targets. This can be fixed by making the Box Collider fit your AI's model better. Make sure the Box Collider is close to the ground to ensure it's not missed. If this doesn't resolve your issue, just let me know.


    I will be reworking/improving events at some point as I see how versatile they can be for users.


    Yes, I wasn't aware that it was release. I'll be reaching out to the developers sometime today. I will work on adding an integration tutorials asap.


    Companions use their own "Confidence" system and that is Combat Style. It's located under the Temperament tab and as either defensive or offensive. Defensive will only allow an AI to attack if its follow target is being attacked and offensive will allow it to attack anything within its attack radius regardless of whether the follow target is being attacked.
     
  25. PlainStudios

    PlainStudios

    Joined:
    Sep 9, 2013
    Posts:
    18
    Could somebody please help me . I'm using UFPS and I can't figure out how to make the AI damage me and how I can damage them . I found some guides on how to setup everything but they are outdated . I also have a problem where the AI would attack eachother but any time I use a UFPS character they would ignore me , I made some objects to test and the AI attack them but they always ignore me
     
  26. DanBanner

    DanBanner

    Joined:
    Dec 11, 2015
    Posts:
    29
    Make sure you have the "Player" layer selected in the AI's "Detection Layers" dropdown (it's multiselect). Found under "Detection & Tags" in the "Tag Options".
     
    PlainStudios likes this.
  27. PlainStudios

    PlainStudios

    Joined:
    Sep 9, 2013
    Posts:
    18
    I do have detection set to the player layer and my player is on the player layer .. The AI just doesn't attack me . I used the exact same setting on a cube I created and they all rushed it . They just won't go for my UFPS character . I tried adding the cube to my character as well but then it just doesn't work either .
     
  28. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,816
    Are you using older UFPS or the new version 2.0 just released?

    [EDIT]
    I just tried on older UFPS and it works. Two key things to note. Don't forget to fix your UFPS Physics to disable "Has collision trigger". And if you are using the Line of Sight example, remember that it won't attack unless it has direct line of sight so you may want to change the enemy to Trigger instead of Line of Sight.
     
    Last edited: Sep 20, 2018
  29. PlainStudios

    PlainStudios

    Joined:
    Sep 9, 2013
    Posts:
    18
    Hi , I'm using the older UFPS , I turned off has collision trigger and it still didn't work . So I made a capsule and did all the setting after which they started attacking it then I went ahead and started copying all the scripts to it and they left it alone . I have been trying to get it to work for a week now but nothing I do makes it work . I guess I should just scrap my game because I can't get the AI to work properly . They attack each other and they attack other objects that I create but the won't attak my UFPS character no matter what I do . Thanks for the help though
     
  30. PlainStudios

    PlainStudios

    Joined:
    Sep 9, 2013
    Posts:
    18
    I narrowed down the problem to the vp_fp controller script but it is not the collision trigger setting
     
  31. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,816
    I can only guess that you must have followed the instructions wrong or you have made other changes to your project that are affecting this such as layers, tags, physics collisions, etc. You should do a sanity test and create a new project and only import UFPS and Emerald AI and then follow the instructions using the Line of Sight demo. If it still doesn't work then I'm truly baffled because I did that exact thing and it was fine.
     
  32. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    257
    Just in case - here is the link to the UFPS Integration Tutorial . I'm not using UFPS, but if you are using the "older" Version of UFPS i think this should not be outdated.
     
    Last edited: Sep 21, 2018
  33. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,816
    Good point. That's the tutorial I used and it worked. But there are older ones out there and maybe that's what he used.
     
    Weblox likes this.
  34. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    257
    @BHS - I know you are super busy with all the updates planned, but speaking of the Integration Tutorials:

    I am using Emerald AI with RFPSP currently and I noticed that Integration is not fully complete. Maybe you can look into the following Issues when finding the time:

    Can you please support us with a script to hook into the Emerald_AI's OnDeath() UnityEvent, that will let us use Emerald AI Agents with the RFPSP "Faction war" and "Wave survival" Modes?

    - RFPSP has its own "Faction war" and "Wave survival" Mode with AI Spawners and a corresponding Wave Manager.To use these Modes and their Spawners the AI Agents must unregister from RFPS when killed, so the Wave Manager & UI can interact with Emerald AI. For example, CharacterDamage.cs does it like this:

    Code (CSharp):
    1. AIComponent.NPCRegistryComponent.UnregisterNPC(AIComponent);//unregister NPC from main NPC registry

    - RFPSP is using Grenades/Mines/Explosives that currently will not damage the Emerald AI Agents. I suppose the Emerald Integration code has to be added to another "case 13" somewhere, but cannot figure out where exactly. :confused:

    As always - Thanks in advance and keep up the good work!
     
    Last edited: Sep 21, 2018
  35. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,212
    I can certainly look into these. Adding an OnDeath event programmatically can be done with doing:
    Code (CSharp):
    1. YourEmeraldAIReference.OnDeath.AddListener(() => YourRFPSEvent());
    So, I'll have to look at how RFPS handles their wave system, but it seems like it should be possible.

    I have been meaning to update the tutorial with info on how to add explosives damage. It's essentially the same as the arrow or melee damage script additions. You look for the case that uses the NPC layer and assign the extra code to damage Emerald AI agents.
     
    Weblox likes this.
  36. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    257
    @BHS - Now that was a quick reply! Thanks a lot for all the hints and tipps.

    When it comes to coding I really tend to mess things up, but I am not in a great rush, so I will wait until you find some time to look into these. Especially the Wave System Integration will be essential to my Demo Project. I will try to get Explosives to work somehow, but good to know you plan on adding this to the Integration Tutorial aswell.

    Thanks again for great support!
     
    Last edited: Sep 21, 2018
  37. PlainStudios

    PlainStudios

    Joined:
    Sep 9, 2013
    Posts:
    18
    Thank you SO MUCH !!! I finally got the problem solved by following the guide provided . The other guides were all outdated . Now I can continue developing my game :D
     
  38. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    984
    How are things going with the Emerald AI updates?
     
  39. AngelBeatsZzz

    AngelBeatsZzz

    Joined:
    Nov 24, 2017
    Posts:
    207
    Hi,I have three questions:

    1.When my UFPS Player collides with the Emerald AI, it slides over the BoxCllider.
    2.Emerald_AI always rotates and moves in battle, how to keep it in a position to attack.
    3.When the Emerald_AI goes to the waypoint, it will cross the building on the road, and the building's boxcollider cannot block it.
     
    Last edited: Sep 22, 2018
  40. DanBanner

    DanBanner

    Joined:
    Dec 11, 2015
    Posts:
    29
    To eleborate on the problem i am having with the AI not going to the destination properly. I have recorded my screen and put the video here...
    http://digitalmedic.co.uk/SetDestinationFail.mp4

    If you look at the scene view you can see a Yellow cube and a Green cube. My script simply sets the destination to the position of the cude (in my case a food object).
    ai.SetDestination(foodObject.transform);

    As you can see the AI went directly to the Yellow cube as expected, but the AI goes wrong when going to the Green cube.

    This is a very intermittent problem as this took 7 attempts until it went wrong, the previous 6 attempts all went perfectly.
     
  41. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,060
    @BHS ,

    I am really looking forward to integrations with TPC2/UCC. The old TPC has been deprecated.
     
    gamequest likes this.
  42. ChaosriftGames

    ChaosriftGames

    Joined:
    Aug 25, 2017
    Posts:
    52
    2 major problems (to me):
    Enemy waits far too long to attack giving the player enough time to simply step away.

    When enemy dies, it is floating halfway in the air. Not like in the demo video where the ogre fell to his knees then landed on the ground.
     
  43. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,212
    Great, I will explain everything in detail within the next couple of days with a status update. The Root Motion support is coming along nicely and looks great, but it's taking longer than expected to implement. I have to completely rebuild the Animator Controllers that Emerald AI generates, but this allows AI to use Blend Trees and have smooth seamless animation transitions. This also means I have to reprogram all of the animation portions of the main scripts. AI that are not using root motion will still of course be supported. I've also been rewriting the code that is responsible for aligning AI with the angle of the terrain and other objects to be far more efficient and look better. I will try to get this update out asap.


    1) This is more of an issue with UFPS. I remember seeing a solution to fix this a little while back, but I cannot remember where unfortunately. I'll see if I can find it again for you.
    2) You can tune this by adjusting the Turning Angle Stationary setting located under AI's Settings>Movement.
    3) You have to bake your scene with Unity's Nav Mesh in order for the AI to properly navigate through your level. A nice guide for this can be found here: https://docs.unity3d.com/Manual/nav-BuildingNavMesh.html


    Thanks for the video. I think I've figured out what's happening. My guess is that the dynamic position generated using the Dynamic Wander Type is never cleared. So, when your AI has reached its destination, it goes to the previously generated dynamic waypoint. Try adding the code below to the top of the SetDestination function within the if statement to see if it fixes your issue. This should reset the NavMesh position before assigning a new one. It's weird because the previous destination should be overwritten by default with Unity's NavMesh system.
    Code (CSharp):
    1. AIAgent.ResetPath();

    I have a copy of UCC so I will work on adding support for it some time this week.


    1) Set your AI's Min and Max Attack Speed to 0. This can be found under AI's Settings>Combat.

    2) You need to make sure you have a death animation applied to the Death Animation slot. You also need to make sure your death animation is supported by your AI's model. Test it in the animation view within the inspector prior to applying it to your AI. Both of these can cause a death animation to float in the air instead of playing.
     
  44. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    984
    Awesome! I think your AI system with the right features will be top notch compared to the others. If the system could somehow do complex fights with the ease of use it has now, you will far and away exceed any other asset store AIs without doing the whole visual scripting thing.
     
    hoodoo likes this.
  45. C_p_H

    C_p_H

    Joined:
    Nov 24, 2014
    Posts:
    150
    Hi @BHS

    There appears to be an issue with EmeraldAi2's windows (for me on Unity 2018.2.9f1 macOS Metal, see attached screen shots below). Eai_Cuts Off even with expanded window.png Eai_Script Window doesn't resize in its panel.png EmaraldAI_Opens Stretched_un-nested.png EmeralAI_Opens Stretched_Nested.png
    Resizing doesn't work properly even if resized to full screen both un-nested and nested(scrolling works to see the cut-off tabs in Unity's Editor but not auto-resizing when adjusting its width) as well as with an old project nor a clean install new project.

    Only errors I can generate in the console is when I attempt to switch the Unity Layout View but not sure if E-Ai2 is a culprit of that, but I've inserted those errors here for your review also just in case it'll provide a clue.
    Failed to destroy views: #44
    HostView
    SplitView

    0 Unity 0x00000001019fcadc _Z13GetStacktracei + 92
    1 Unity 0x0000000100c0ab7b _Z17DebugStringToFileRK21DebugStringToFileData + 795
    2 Unity 0x0000000101e54f26 _ZN15DebugLogHandler12Internal_LogE7LogTypeN4core12basic_stringIcNS1_20StringStorageDefaultIcEEEEP6Object + 310
    3 Unity 0x0000000101e54cfa _Z35DebugLogHandler_CUSTOM_Internal_Log7LogTypeP10MonoStringP10MonoObject + 330
    4 (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,string,UnityEngine.Object)
    5 (Mono JIT Code) [WindowLayout.cs:483] UnityEditor.WindowLayout:LoadWindowLayout (string,bool)
    6 (Mono JIT Code) (wrapper runtime-invoke) <Module>:runtime_invoke_bool_object_byte (object,intptr,intptr,intptr)
    7 libmonobdwgc-2.0.dylib 0x0000000144f0ec74 mono_jit_runtime_invoke + 2519
    8 libmonobdwgc-2.0.dylib 0x00000001450cf221 do_runtime_invoke + 80
    9 libmonobdwgc-2.0.dylib 0x00000001450cf17f mono_runtime_invoke + 31
    10 Unity 0x0000000101032dfa _ZN19ScriptingInvocation6InvokeEP21ScriptingExceptionPtrb + 106
    11 Unity 0x0000000101951ab9 _ZN16WindowLayoutMenu7ExecuteERK8MenuItem + 201
    12 Unity 0x000000010197450e _ZN14MenuController15ExecuteMenuItemER8MenuItemNS_14ExecutionCauseE + 110
    13 Unity 0x00000001006bb9f4 -[CocoaMainMenu executeStandard:] + 324
    14 AppKit 0x00007fff286bea43 -[NSApplication(NSResponder) sendAction:to:from:] + 312
    15 AppKit 0x00007fff28153213 -[NSMenuItem _corePerformAction] + 323
    16 AppKit 0x00007fff28152f9b -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 114
    17 AppKit 0x00007fff281d8c7a -[NSMenu performActionForItemAtIndex:] + 133
    18 AppKit 0x00007fff281d8be5 -[NSMenu _internalPerformActionForItemAtIndex:] + 94
    19 AppKit 0x00007fff281d8a15 -[NSCarbonMenuImpl _carbonCommandProcessEvent:handlerCallRef:] + 106
    20 AppKit 0x00007fff2809f2a2 NSSLMMenuEventHandler + 882
    21 HIToolbox 0x00007fff29c4e904 _ZL23DispatchEventToHandlersP14EventTargetRecP14OpaqueEventRefP14HandlerCallRec + 1541
    22 HIToolbox 0x00007fff29c4dc4d _ZL30SendEventToEventTargetInternalP14OpaqueEventRefP20OpaqueEventTargetRefP14HandlerCallRec + 374
    23 HIToolbox 0x00007fff29c62f21 SendEventToEventTarget + 39
    24 HIToolbox 0x00007fff29cac3f9 _ZL18SendHICommandEventjPK9HICommandjjhPKvP20OpaqueEventTargetRefS5_PP14OpaqueEventRef + 411
    25 HIToolbox 0x00007fff29cd52ee SendMenuCommandWithContextAndModifiers + 49
    26 HIToolbox 0x00007fff29cd52aa SendMenuItemSelectedEvent + 188
    27 HIToolbox 0x00007fff29cd5184 _ZL19FinishMenuSelectionP13SelectionDataP10MenuResultS2_ + 96
    28 HIToolbox 0x00007fff29ded87c _ZL19PopUpMenuSelectCoreP8MenuData5PointdS1_tjjPK4RecttjS4_S4_PK14__CFDictionaryPK10__CFStringPP13OpaqueMenuRefPt + 1662
    29 HIToolbox 0x00007fff29deccf7 _ZL26_HandlePopUpMenuSelection8P13OpaqueMenuRefP14OpaqueEventRefj5PointtjjPK4RecttS6_S6_PK14__CFDictionaryPK10__CFStringPS0_Pt + 409
    30 HIToolbox 0x00007fff29cb540c _HandlePopUpMenuSelectionWithDictionary + 268
    31 AppKit 0x00007fff281cf79a _NSSLMPopUpCarbonMenu3 + 5632
    32 AppKit 0x00007fff281ce0f4 -[NSCarbonMenuImpl popUpMenu:atLocation:width:forView:withSelectedItem:withFont:withFlags:withOptions:] + 439
    33 AppKit 0x00007fff2823e25c -[NSPopUpButtonCell trackMouse:inRect:eek:fView:untilMouseUp:] + 570
    34 AppKit 0x00007fff282b7067 -[NSPopUpButtonCell performClickWithFrame:inView:] + 128
    35 Unity 0x00000001006beb74 _Z22ShowDelayedContextMenuv + 1940
    36 Unity 0x00000001006d828d _ZN7GUIView12OnInputEventER10InputEvent + 1453
    37 Unity 0x000000010194dd82 _ZN7GUIView17ProcessInputEventER10InputEvent + 50
    38 Unity 0x00000001006f0384 -[GUIRenderView mouseDown:] + 132
    39 AppKit 0x00007fff2885dd6d -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 5891
    40 AppKit 0x00007fff2885a9c4 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 2359
    41 AppKit 0x00007fff28859c70 -[NSWindow(NSEventRouting) sendEvent:] + 497
    42 AppKit 0x00007fff286bb236 -[NSApplication(NSEvent) sendEvent:] + 2462
    43 Unity 0x00000001006e2d6b -[EditorApplicationPrincipalClass sendEvent:] + 267
    44 AppKit 0x00007fff27f1b8b5 -[NSApplication run] + 812
    45 AppKit 0x00007fff27eeaa72 NSApplicationMain + 804
    46 Unity 0x00000001006e3217 _Z10EditorMainiPPKc + 839
    47 Unity 0x00000001006e3699 main + 9
    48 libdyld.dylib 0x00007fff52879015 start + 1

    Thanks for taking the time to investigate.:confused:
     
  46. PlainStudios

    PlainStudios

    Joined:
    Sep 9, 2013
    Posts:
    18
    I have a problem . I made one AI enemy and it works fine so I made another the problem now is that when I try to create the animation override controller I get an error .

    This is the error

    NullReferenceException: Object reference not set to an instance of an object
    Emerald_AI_Editor.OnInspectorGUI () (at Assets/AI/Scripts/Editor/Emerald_AI_Editor.cs:4114)
    UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor[] editors, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1374)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
     
  47. claudiorodriguescampos

    claudiorodriguescampos

    Joined:
    Jun 23, 2017
    Posts:
    98
    I use Emerald AI integrated with UFPS into two games. One game uses the old Emerald AI version 1. The newer game uses Emerald AI version 2. In the first game, I use a grenade and it works perfectly. I use the same grenade in the second game. But for some reason, the grande doesn't give damage to Emerald AI enemy in Emerald version 2.

    I receive the following error message:
    Code (CSharp):
    1. Failed to call function Damage of class Emerald_AI
    2. Calling function Damage with 1 parameter but the function requires 2.
    3. UnityEngine.GameObject:BroadcastMessage(String, Object, SendMessageOptions)
    4. vp_Explosion:TryDamage() (at Assets/UFPS/Base/Scripts/Gameplay/Combat/vp_Explosion.cs:285)
    5. vp_Explosion:DoExplode() (at Assets/UFPS/Base/Scripts/Gameplay/Combat/vp_Explosion.cs:254)
    6. vp_Explosion:Update() (at Assets/UFPS/Base/Scripts/Gameplay/Combat/vp_Explosion.cs:180)
    the error is coming from this line
    Code (CSharp):
    1. m_TargetCollider.gameObject.BroadcastMessage(DamageMessageName, (DistanceModifier * Damage), SendMessageOptions.DontRequireReceiver);
    How can I fix this?
     
    Last edited: Sep 26, 2018
    nellecter likes this.
  48. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,212
    Thanks for the bug report.

    There was another user who was having the same problem with Unity 2018.2.6f1, but I was not able to recreate it. I'm wondering if it is related to Mac. I don't think I have had any other reports of it. As soon as I find out what's causing it, I will be able to find a fix. Sorry for the inconvenience.

    @Darrkbeast There's another user who is having the same window scaling issue, are you using mac as well?


    Hey there,

    There are a few things that can cause an error like that. Are you using the Setup Manager or the Create Animator button within the Emerald AI editor?

    Please double check the following:
    1) Have you rearranged the folder structure of Emerald AI? Currently, it is dependent on having the Emerald AI folder in the main Assets folder.
    2) Is this a duplicate AI or a different model?
    3) Do you have an Animator and Avatar attached to your AI object? Not doing this can cause that error.


    Emerald AI changed the function that handles damage. Is that a custom BroadcastMessage?

    Try using:
    Code (CSharp):
    1. m_TargetCollider.gameObject.GetComponent<Emerald_AI>().Damage(Mathf.Round(DistanceModifier * Damage), Emerald_AI.TargetType.Player);
     
  49. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    984
    What updates does your next release have?
     
  50. claudiorodriguescampos

    claudiorodriguescampos

    Joined:
    Jun 23, 2017
    Posts:
    98
    Your code works, thank you. I just made a small change to it.

    Code (CSharp):
    1. if (m_TargetCollider.gameObject.tag == "Emerald AI"){
    2.     m_TargetCollider.gameObject.GetComponent<Emerald_AI>().Damage( (int)Mathf.Round(DistanceModifier * Damage), Emerald_AI.TargetType.Player);
    3. }
    About the broadcast message that you asked. I must confess that I have no idea where this comes from. If it was from Emerald 1, UFPS or another source code.
     
unityunity