Search Unity

NodeCanvas - (Behaviour Trees | State Machines | Dialogue Trees)

Discussion in 'Assets and Asset Store' started by nuverian, Feb 8, 2014.

  1. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Thanks a lot for your feedback! :)
    I will PM you when I start taking a look at UFrame and if I get stuck :)

    Cheers!

    It's an obscured feature :)
    Cheers!

    Hey,

    First of all thanks for getting NodeCanvas!
    Have you downloaded the example scenes and take a look at them? This is exactly what they are for :)
    http://nodecanvas.com/resources/

    Also, are you refering to Behaviour Trees or FSM?

    Let me know and I can give you any example you require, but also please make sure to check the example scenes.

    Thanks!
     
  2. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hello,

    Thanks for the info. If you could somehow replicate the issue and is possible, could you please PM or email me the replication project? Meanwhile I will try and replicate this here if possible and post back if I discover something nasty :)

    Thanks!
     
  3. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    I've tried this method, and a first few time it works, but then I got this error:
    Code (CSharp):
    1. Graph:</b> You have tried to start a graph which is an asset, not an instance! You should Instantiate the graph first
    2. UnityEngine.Debug:LogError(Object)
    3. NodeCanvas.Framework.Graph:StartGraph(Component, IBlackboard, Action`1) (at Assets/NodeCanvas/Framework/Runtime/Graphs/Graph.cs:481)
    4. NodeCanvas.StateMachines.NestedFSMState:OnEnter() (at Assets/NodeCanvas/Modules/StateCanvas/Nodes/NestedFSMState.cs:50)
    5. NodeCanvas.StateMachines.FSMState:OnExecute(Component, IBlackboard) (at Assets/NodeCanvas/Modules/StateCanvas/FSMState.cs:110)
    6. NodeCanvas.Framework.Node:Execute(Component, IBlackboard) (at Assets/NodeCanvas/Framework/Runtime/Graphs/Node.cs:241)
    7. NodeCanvas.StateMachines.FSM:EnterState(FSMState) (at Assets/NodeCanvas/Modules/StateCanvas/FSM.cs:122)
    8. NodeCanvas.StateMachines.FSMState:CheckTransitions() (at Assets/NodeCanvas/Modules/StateCanvas/FSMState.cs:143)
    9. NodeCanvas.StateMachines.FSMState:Update() (at Assets/NodeCanvas/Modules/StateCanvas/FSMState.cs:122)
    10. NodeCanvas.StateMachines.FSM:OnGraphUpdate() (at Assets/NodeCanvas/Modules/StateCanvas/FSM.cs:74)
    11. ParadoxNotion.Services.MonoManager:Update() (at Assets/NodeCanvas/Framework/_ParadoxNotion (shared)/Runtime/Services/MonoManager.cs:62)
    12.  
    I just use code to assign a BB variable to hold the state.asset to be executed. How can I instantiate a graph?
     
  4. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    In file NestedFSMState.cs and NestedFSM.cs,
    Code (CSharp):
    1. void CheckInstance(){
    2.  
    3.             if (instances.Values.Contains(nestedFSM))
    4.                 return;
    5.  
    6.             if (!instances.ContainsKey(nestedFSM))
    7.                 instances[nestedFSM] = ( nestedFSM = Graph.Clone<FSM>(nestedFSM) );
    8.         }
    This means that if I reassign an FSM .asset to the Sub-FSM Node via a BB variable, and that FSM .asset already have an instances in that node before, it will use the asset reference instead of the instance.
    If I change it to:
    Code (CSharp):
    1. void CheckInstance ()
    2.         {
    3.  
    4.             if (instances.Values.Contains (nestedFSM)) {
    5.                 return;
    6.             }
    7.  
    8.             if (!instances.ContainsKey (nestedFSM)) {
    9.                 instances.Clear (); //Should I add this to prevent memory leak if the state will be changed often in my project
    10.                 instances [nestedFSM] = (nestedFSM = Graph.Clone<FSM> (nestedFSM));
    11.             } else {
    12.                 nestedFSM = instances [nestedFSM];
    13.             }
    14.         }
    Should it be okay? It seems to work flawlessly.

    If this fix will be integrate into the official NodeCanvas, please tell me, so I will edit the source file itself. Currently, I create a custom class that copy from NestedFSM for I fear that the change will be lost when update NC.
     
    Last edited: Sep 7, 2015
  5. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087

    Ah, thanks for the fix.
    Yes, I will add this in the next version :)
    Just to confirm, the problem with the initial code, is that reasigning the same .asset a second time in runtime, results in using the .asset rather than using the existing instance.

    Cheers!
     
  6. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    Is there a way to lock the NC Editor screen to the graph of interest that will not be lost when entering Play mode? My game have many layers of sub-graph, but when hit Play, it will pop back to the top layer.
     
  7. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey,

    This is something that is high in my TODO list, but at this time it's not possible. Be certain though that it will be done at some point :)

    Thanks!
     
  8. fareyestudio

    fareyestudio

    Joined:
    Jun 12, 2015
    Posts:
    2
    Good day I am getting an error when importing the Unity 5 samples. For me to get the error to go away I have to delete the the DT folder.

    Can this be fixed.

    Once I do I am able to run the other included FSM and BT samples
     
    Last edited: Sep 19, 2015
  9. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    Hey anyway to add Dictionary to Blackboard?
     
  10. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey,
    Sorry for late reply. I have fixed the sample scenes now. Please re-download them here.
    Thanks for noticing.

    Cheers!

    Hey,
    Sorry for the late reply.

    Because dictionaries need 2 generic arguments, adding dictionaries through the editor GUI is not supported right now, but you can certainly get, set and use a dictionary blackboard variable in code.
    Code (CSharp):
    1.             var dict = new Dictionary<string, float>();
    2.             blackboard.SetValue("myDictionary", dict);
    3.             blackboard.GetValue<Dictionary<string, float>>("myDictionary");
    Cheers!
     
  11. Async0x42

    Async0x42

    Joined:
    Mar 3, 2015
    Posts:
    104
    Would you be able to add the 'last updated' date to the downloads? It got lost after the first request :) I'm always re-downloading things after updates, to see if anything has changed since then.

    It'll save us time, and you bandwidth! (although maybe not much :p)
     
  12. redmotion_games

    redmotion_games

    Joined:
    May 6, 2013
    Posts:
    84
    Hi Nuverian,
    I'm probably making a schoolboy error but I've set up a very simple state machine to switch between different UI screens. I'm using unity UI and setting one of three panels active and the other two are deactivated. On every panel are buttons and I'm using the UGUI if_button_clicked condition to move between each state. I set the conditions by drag dropping the button objects into the conditions. Then I run it. It works fine.

    But when I stop and go back to node canvas - the buttons I assigned to the conditions have disappeared and it says NULL. Is this a bug? (Some of the buttons still have NULL assignments when I press run).

    EDIT: Is it because I didn't "bind" the graph to the scene object? I just did that and not it's not happening.
     
    Last edited: Sep 26, 2015
  13. unitywlp

    unitywlp

    Joined:
    Jan 3, 2014
    Posts:
    146
    can we request to support for 3rd party plugins
     
  14. Async0x42

    Async0x42

    Joined:
    Mar 3, 2015
    Posts:
    104
    Nuverian's been really great about adding NodeCanvas support for various assets, if people request them, so I recommend just mentioning which asset you want, right off the bat, instead of asking! Go for it!
     
    nuverian likes this.
  15. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey,

    Yes, if you want to have references to scene objects direclty in your graphs, then the graph has to be bound. The reason for that is the common thing with unity, that asset files can't have references to scene objects. If you definetely want to use non bound graphs, you can work around this by using Blackboard variables, considering that the agent (which has the blackboard attacked) is not a prefab of course.

    Hope this helps :)

    Hey,
    Of course! Let me know what you are after :)

    Thanks! On a sidenot, I will update the 3rd party assets on the website soon. I will make sure to add the date this time :)

    Cheers!
     
    Async0x42 likes this.
  16. Johat

    Johat

    Joined:
    Mar 11, 2013
    Posts:
    6
    Hi nuverian,

    Firstly, just wanted to say thanks for NodeCanvas -- it's been really nice to use. I just had a couple of issues.

    1. The logic flow of the graph when running isn't always displayed (where it shows the path along the tree taken -- red for failures, green for successes, etc.). Which is a shame because this is a really useful feature for debugging behaviour!

    In my setup, I have a behaviour tree bound to a behaviour tree owner. This owner exists in a scene that is loaded additively into the game and there's a script which handles starting/stopping the behaviour tree manually (it happens to occur on enable/disable anyway, but that's besides the point).

    I can never see the logic flow on this graph unless I press the button on the behaviour tree owner to do the next tick of the behaviour, which is unhelpful since I want to be able to see this triggered by the game. Even then, only that tick is shown and any other updating doesn't get updated correctly.

    Just wondered if this was a known issue/there was anything I'm missing here?

    2. A bigger problem is that behaviour tree doesn't seem to work at all on iOS! I haven't had chance to really check through and pick it apart yet to look properly, but I couldn't see anything I was doing wrong after an initial look through.

    The tree isn't doing anything crazy, just has bound properties, which it uses to check and then perform actions. Nothing more complicated than "is x < y?" and perform action z, which is just a custom action that calls a function. At the moment it all happens over one tick as well (there's no delay/time dependency). I'm not doing any send message or calling functions through the graph (e.g. owner.MyFunction), just using actions to execute regular simple C# code.

    It works fine on Android, PC and Mac, but on iOS it looks like the behaviour tree doesn't even get started/initialised! Is there something I'm missing here? iOS is one of the lead platforms for our current project, so it's quite important.

    Haven't had time yet to get to any more methodical tests, but just wanted to see if there was an obvious fix/known problem first.

    Thanks again.
     
  17. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
    Hi Johat,

    I just compiled the Imaginary Cat sample from the demo resources and ran it on my iPhone without issues. You may want to use the debugger on the device to see what is happening.
     
    hopeful likes this.
  18. Johat

    Johat

    Joined:
    Mar 11, 2013
    Posts:
    6
    Hey kenlem,

    Thanks for the head's up. I'll see if I can track the problem on my end =).
     
  19. AVOlight

    AVOlight

    Joined:
    Apr 15, 2014
    Posts:
    427
    Has this been tested working with build target: Windows Store Universal 10? On the latest Unity 5.2.1p1
     
  20. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hello and thanks as well!
    Let me answer your questions :)

    1. I can't seem to replicate this issue. Does the behaviour tree of the agent works correctly, but it is just the editor that doesn't update correctly? I mean, does the behaviour tree is actually running and the "PLAY" button UI on the BehaviourTreeOwner is looking "pressed"?
    Please let me know.

    2. NC should work on iOS, yes. Does the cat example works for you as kenlem stated? Please let me know if you have any more information/logs of the issue.

    Thanks!

    Thanks :)

    Hello,
    I haven't yet checked on 10, although it should work fine. I will run a check soon though for confirmation :)
     
    AVOlight likes this.
  21. AVOlight

    AVOlight

    Joined:
    Apr 15, 2014
    Posts:
    427
    Thank you :)
     
  22. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
    Hi Nuverian -

    It was nice to meet you in person at Unity 2015 in Boston.

    I dug out Node Canvas again and gave it a second look and now I totally love it. I'm still trying to wrap my head around Behavior Trees but it's all starting to make sense now. I'd love to see some more examples of BT's for enemy AI if you have any.

    Regards,
    Ken
     
  23. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
    So how do make detecting the player interrupt patrolling? Right now I have the two connected to a priority selector. Do I use an interrupt decorator on patrol?
     
  24. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
    Found it. I used a Dynamic Selector. In about 45 minutes, I created BT where the enemy patrols waypoints, chases the player and attacks if the comes into his sight with a certain distance, returns to home base if too far from home and flees if his health is low. It still needs some polish but I just simply couldn't have written all that in C# in that amount of time. I'm very impressed with BT's and Node Canvas.
     
    hopeful likes this.
  25. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
    So I want to save the starting position of the enemy to a blackboard value when the tree first starts up so I can use that value as the enemie's home base. Any suggestions? Would that just be a sequence that checks to see if that value is null and sets it with the objects current position?
     
  26. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    @kenlem

    Hey,

    I'm very glad you like Behaviour Trees in NodeCanvas! :)

    Yes, interruping Running actions can either be done through Interruptor decorator or better yet by setting the node to be "Dynamic" as you soon find out. In my opinion using Dynamic nodes is more robust, while the Interruptor decorator is there more for "legacy" reasons, although there might be some cases worth using instead of a dynamic node.

    Regarding your last question about storing the position at the start of the tree, this can be done using the "Filter" decorator and set it to Limit the "Number of Times", then connect the "GetProperty" action task as a child and choose Transform.position.
    2015-10-01_22h56_29.png

    You could certainly check for null in a Sequencer and then perform some action when the Check Null condition is true, depending on what you are after.

    Let me know if you have any questions or need more clarification. :)

    Thanks again!
     
  27. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
    Thanks for the reply! You suggestion to use a Filter decorator sounds perfect.
     
  28. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
    I want to add my own condition to check the distance to a Vector3. It seems to work but I'm not sure the class definition line is correct (ConditionTask<Transform> ). Suggestions?

    Code (CSharp):
    1. using NodeCanvas.Framework;
    2. using ParadoxNotion;
    3. using ParadoxNotion.Design;
    4. using UnityEngine;
    5.  
    6.  
    7. namespace NodeCanvas.Tasks.Conditions{
    8.  
    9.     [Name("Target Within Distance to Position")]
    10.     [Category("GameObject")]
    11.    public class CheckDistanceToPosition : ConditionTask<Transform>
    12.  
    13.         [RequiredField]
    14.         public BBParameter<Vector3> checkTarget;
    15.         public CompareMethod checkType = CompareMethod.LessThan;
    16.         public BBParameter<float> distance = 10;
    17.  
    18.         [SliderField(0,0.1f)]
    19.         public float floatingPoint = 0.05f;
    20.  
    21.         protected override string info{
    22.             get {return "Distance" + OperationTools.GetCompareString(checkType) + distance + " to " + checkTarget.value.ToString();}
    23.         }
    24.  
    25.         protected override bool OnCheck(){
    26.             return OperationTools.Compare(Vector3.Distance(agent.position, checkTarget.value), distance.value, checkType, floatingPoint);
    27.         }
    28.     }
    29. }
     
  29. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey,

    When you use the generic ConditionTask (or ActionTask), like you do, it means that the task is ment to be used with a <T> component on the owner. In this case Transform.
    When you do that, the "agent" property is always of type T, the component is automatical checked and stored, and this also saves you from calling GetComponent.

    For example:
    Code (CSharp):
    1. public class PlayAnimation : ActionTask<Animation>{
    2.  
    3.     public BBParameter<string> animationName;
    4.  
    5.     protected override void OnExecute(){
    6.  
    7.         agent.Play(animationName.value);
    8.         EndAction();
    9.     }
    10. }
    You don't have to use generic tasks, but makes things a bit easier. Also you might not want to do that and instead use non generic ConditionTask and ActionTask, in case of tasks that don't require a specific component on the agent.

    Let me know if this is the information you were after.

    Cheers!
     
  30. Johat

    Johat

    Joined:
    Mar 11, 2013
    Posts:
    6
    Hey nuverian,

    Thanks for the reply.

    Let me get back to you on the first issue -- I'll try to find a reliable way to replicate the issue. The play UI icon doesn't look like it's pressed when this occurs though.

    So, the log I'm getting on our project is that there is no start node on the behaviour tree (just when on iOS) -- and there definitely is a start node.

    I went through the example projects and found the following:

    • The cat example works fine.
    • The variables data binding scene doesn't work on iOS at all (I added a simple UI text to keep to see if the variable was being set/changed and it wasn't).
    • The iterator controller test also didn't work, which was to be expected. However, I changed all the method calls to use the multiplatform versions and this still didn't work on iOS.
    (All of these worked fine in the editor on the mac).

    So to me it's looking like the problem occurs when using the blackboard variables data binding or function calls. In our project, we are only using property binding. The tree works fine on all platforms except iOS where is doesn't start -- seems to lose the start node?

    Are there any specific player settings I should be using for iOS that may be related to this?

    Thanks again for your time,

    All the best.
     
  31. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
    alexthomasren likes this.
  32. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey,
    Thanks for the information. I am going to take a look today and post back asap. It should be something easy to fix.
    Thanks again :)

    Hey,
    Thanks for sharing :)
     
  33. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
    Arg...

    I complied for iOS and get
    Code (CSharp):
    1. <b>Graph:</b> You've tried to start graph without 'Start' node
    2. UnityEngine.Debug:Internal_Log(Int32, String, Object)
    3. UnityEngine.Debug:LogWarning(Object)
    4. NodeCanvas.Framework.Graph:StartGraph(Component, IBlackboard, Action`1)
    5. NodeCanvas.Framework.GraphOwner`1:StartBehaviour()
    6. NodeCanvas.Framework.GraphOwner:Start()
    The odd thing is that I have 4 BT's in the scene. Two Orges and two dogs. The Orges don't work but the dogs do.
     
  34. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    Did you set a Start node for each graph?
     
  35. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
    Yes, each graph has a start node. It works fine in editor and native Mac OS and web player builds.
     
  36. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    @nuverian
    [EventReceiver("OnCustomEvent")] doesn't seem to work in ActionTask. Is this as intent? Can you add such support as a new feature? As in FlowScript, we can receive custom event there.
     
  37. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey,

    Thanks for the info. Can you please send me the project if at all possible? I will be able to pinpoint and fix the issue faster.
    Thanks a lot in advance :)

    Hey,
    I just re-checked and it works as expected. For example:
    Code (CSharp):
    1. [EventReceiver("OnCustomEvent")]
    2. public class TestAction : ActionTask{
    3.  
    4.     void OnCustomEvent(EventData e){
    5.         if (e.name == "test"){
    6.             EndAction();
    7.         }
    8.     }
    9. }
    Can you please share what seems to be wrong in your case?

    Thanks in advance!
     
  38. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    My code is just like yours, but they just don't receive the message send from the UI.

    The message is sent by this command
    Code (CSharp):
    1. public void OnButtonClick(string text)
    2.     {
    3.         GameMaster.SendEvent(_commands[Int32.Parse(text)]);
    4.     }
    A UI button will send a number string to OnButtonClick() and this method will send a command string to FSMOwner called GameMaster. The Condition Tasks work fine, but the Action Task won't receive the message.
     
    Last edited: Oct 5, 2015
  39. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    That's weird. Here is what I just tried.

    Created a Button and selected to SendEvent("test") to an FSMOwner onClick.
    2015-10-05_20h28_16.png


    Then the FSM, which has this code:
    Code (CSharp):
    1.     [EventReceiver("OnCustomEvent")]
    2.     public class TestAction : ActionTask{
    3.  
    4.         void OnCustomEvent(EventData e){
    5.             if (e.name == "test"){
    6.                 Debug.Log("Received");
    7.                 EndAction();
    8.             }
    9.         }
    10.     }
    2015-10-05_20h27_26.png

    At runtime, when I click the button, the 1st state finishes, jumps to 2nd state and then back again as expected.
    Just to confirm, does something like the above works for you?

    One thing that comes in mind in your case might be this:
    Does the state which has the ActionTask has a chance to be called before the event is send? Is that state ever triggered before the SendEvent? Attributes like [EventReceiver] are only initialized after the first time the Task is called right now.

    Let me know.
     
  40. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    In my case the receiver state also have OnExecute() and OnUpdate(). The state will continue until the botton is pressed, so there is no chance that the message was sent before the first time finished.

    PS. I have an idea about what happen that needed to be tested. May be if the state with EventReceiver attribute attached to ActionTask have other conditionTask attached as transition, will cause the problem. ( my case is like that)
     
    Last edited: Oct 6, 2015
  41. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    I think I found the cause of the problem. The ActionTask Node cannot have a custom agent set in the Task Inspector (i.e. ActionTask<xxx> and set in the inspector which cause * before the node's name).

    Now I can do a work around, but can you add support for this?

    Another improvement that I wish to have is when using a FSM with Nested BT Node. If in the main FSM has any AnyState node the check for some CustomEvent message(s). When the condition is true, and the tradition occur during the BT Node is working. The BT Node will continue to run, causing unexpected behavior.
     
    Last edited: Oct 7, 2015
  42. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
    Nuverian - I sent you a link to my project. Did you get it?
     
  43. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Ah. Now I see what you mean.
    As it currently works, if a Task has an override agent set, then the event is wait to be received on that target agent, which allows for some flexibility. I could though add a boolean option to the EventReceiver attribute for registering the event to the GraphOwner regardless of override agent. Would that suffice for your case?

    Can you please provide a bit more info on your 2nd suggestion/issue?

    Thanks.

    Hey,
    Yes. Thanks a lot for sending this. I will take a look tomorrow and let you know :)
    Cheers!
     
  44. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    For the first point, yes, that would suffice.

    For the second point, it's more like a bug. I made an FSM graph that including a nested BT state. In the main FSM graph, I have AnyState node that will make a transition when receiving certain string from SendEvent(str) method. The transition can occur during the BT is running. The expected behavior would be that the nested BT state is terminate with the transition. But the BT will continue to run even the transition already occur elsewhere in the graph causing unexpected behaviors.
     
  45. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    I now see the issue. It's due to something changed in last versions. I have PMed you the fix now.
    Thanks for noticing :)
     
  46. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    @nuverian Another issue: OnCustomEvent in ActionTasks will continue to be executed whenever there is a message sent to the FSMOwner even when the ActionTask nodes are not running. For example, the code below will be executed when graph receive "Confirm" message even the state is not running, causing undated behavior as the code manipulate global variables. I have to add if (isRunning) to prevent unwanted behavior.

    Code (CSharp):
    1. void OnCustomEvent(EventData receivedEvent)
    2.         {
    3.             if (isRunning)
    4.             {
    5.                 if (receivedEvent.name == "Confirm")
    6.                 {
    7.                     Debug.Log(string.Format("<b>Event Received from ({0}): </b> '{1}'", agent.name, receivedEvent.name));
    8.                     if (_combatVM.PowerIndex >= 0 && _combatVM.PowerIndex < _combatVM.Powers.Count)
    9.                     {
    10.                         CurrentPower.value = Database.GetMagic(_combatVM.Powers[_combatVM.PowerIndex]);
    11.                         EndAction(true);
    12.                     }
    13.                 }
    14.             }
    15.         }
     
    Last edited: Oct 9, 2015
  47. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087

    Hey,
    The code responsible for the event handling (MessageRouter.cs) doesn't know if the object it sends the event to is an Action, Condition, or something else. It's handled in a more generic way, but I will take a look to streamline and avoid this from happening.

    Thanks!
     
  48. Johat

    Johat

    Joined:
    Mar 11, 2013
    Posts:
    6
    Hey,

    How's everything going with the iOS issue?

    Just to add, I tried a workaround for iOS by removing the bound variables and just using normal blackboard variables and that also didn't work. Seems like there's a general issue with blackboard variables on iOS?

    I'll try and send over a small project later that has all this reproducible in it later today to help you track it down =).

    Cheers!
     
  49. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey,
    I think, I've found the issue yes. To criss cross this, can you please post a screen of the offending blackboard, or better yet PM me the project if possible. The issue should be the TYPE of variables you are using, but I would like to confirm that by your case.

    Thanks!
     
  50. Johat

    Johat

    Joined:
    Mar 11, 2013
    Posts:
    6
    Hi,

    That's great =). Yeah, I was beginning to wonder if it may be related to variable types.

    Our project is pretty huge, so I'll create a fresh project for you that reproduces the issues. I'll try to get that over to you when I have a moment this evening.

    Thanks again. =)