Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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
    You are welcome :)
    Sorry for late reply. I was offsite.

    It seems that this is a MAC issue regarding the usage of the "|" character. Weird. Can you please try and change that character in EditorUtils.cs in ComponentField function at about line 364 and let me know if the "|" is the issue. (I don't have a mac). If yes, I will change that in the next update.

    Yes, the middle mouse button panning a node is a known problem. I will take another look at it.

    Thanks
     
  2. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    So, I've submitted new version 1.4.3 . Here is what's new/changed:

    • Fixed bug on MAC context menus
    • RequiredField attribute will now also work on BBVariables to check their value
    • BBVariable names will no longer get automaticaly cleared when their name doesn't exist in the current blackboard.
    • Category and AgentType attributes will now be inherited to concrete classes.
    • Dialogue Say node Text can now display a variable value from the blackboard by using square brackets in the text (eg [myFloat] )

    New Tasks
    • ITween Look
    • ITween Move
    • ITween Move Amount
    • ITween Rotate
    • ITween Rotate Amount
    • ITween Scale
    • ITween Scale Amount
    • ITween Punch
    • ITween Stop
    • Compose Vector (get new vector out of 3 floats)
    • Decompose Vector (get 3 floats out of one vector)
    • Get Input Axis
    • Get Mouse Position

    Have fun :)
     
  3. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Seriously...ITWeen?! This is the slowest tweener. :(
     
  4. bkw

    bkw

    Joined:
    Sep 20, 2013
    Posts:
    49
    I ran a few strings through.
    "Type | Name" shows " Name"
    "| Type | Name" shows "| Type | Name"
    "Type || Name" shows "| Name"
    "Type | Name |" shows " Name |"
    "<Type> Name" shows the same.
    "Type (Name)" shows the same.

    So something is definitely weird when there's a pipe character. (and it isn't the first character, since "|NONE|" found elsewhere appears just fine)
     
  5. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Thanks a lot for checking that out!
    Yeah, something seems weird with that character and OSX :)
    I will replace it wherever it apears and is not first one. In the update just submited, I've already replaced it for the ComponentField.
     
  6. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    I can always add a HotTween or LeanTween. These are just Actions, nothing coupled :)
     
  7. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Thank for the reply. Both are betters than iTween.
     
  8. bkw

    bkw

    Joined:
    Sep 20, 2013
    Posts:
    49
    I'm trying to customize the BT/BB stuff a bit to suit my own needs. Am I correct to think that if a variable does not exist on a blackboard, and it gets automatically added during run-time, its performance is actually worse than if the variable was pre-defined?

    Looking at the code, BBValues that don't have linked data will call BB's SetDataValue, which automatically creates the variable. Is there a reason why the data reference that's returned by SetDataValue is not kept by the BBValue so that next time it won't need to call SetDataValue (and go through GetData, which searches through the BB variables)?
     
  9. Agostino

    Agostino

    Joined:
    Nov 18, 2013
    Posts:
    21
    Greetings, I looked at website of this asset, but could not play the example videos, I'm using Firefox on Ubuntu.
    http://nodecanvas.com/examples/

    I'm evaluating this because of the sale.
    I can code C#, but documentation is important for me.
     
  10. nuverian

    nuverian

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

    BBValue objects mostly exist to allow a selection of either a blackboard variable or direct value from within the editor when designing. Regardless, a data reference is kept whenever the data name is set or the blackboard to read/write from/to is set. I could keep a reference when Write is called as well if that's what you mean, but it's omited since most probably a reference will alreay exist.
    If you want to dynamicaly get/set variables, the most common way would be by using GetDataValue or SetDataValue on the blackboard anyway. The difference is marginal.

    Please let me know what you are after so that I can help you suit your needs :)


    Hello there,

    These are not videos on this page. They are Unity web players which showcase the graph in the screenshot shown bellow each one :)
    There are lot of documentation to read about online on how to Create Tasks, Use the Blackboard or system specifics for example.
    Furthermore there is a quick start PDF you can read :)

    For any question please do ask :)
     
    Last edited: May 13, 2014
  11. Spyderworxs

    Spyderworxs

    Joined:
    Aug 21, 2012
    Posts:
    31
    Wondering if I have missed something. When I create a Behaviour Tree and right click I can create an Action or a Condition only. I can't seem to create Composites, Decorators or Nested as they are grayed out. Is this normal behaviour?
     
  12. nuverian

    nuverian

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

    There is a bug on the context menus and on MACs. Something that has been fixed in the latest submited version which is not yet online.

    I've already PMed you with the fix to this.

    Thanks and sorry for the trouble on MAC.
     
  13. jemstars

    jemstars

    Joined:
    Nov 7, 2013
    Posts:
    6
    Hi I just purchased the plugin via the 24 hour deal, and I am running on a mac, I believe that I have the same issue, since the context menus are not behaving properly.

    Can you send the fix to me as well?

    Thank you,

    -John
     
  14. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Please enable PMs and I will send it ASAP :)
    Thanks.
     
  15. jemstars

    jemstars

    Joined:
    Nov 7, 2013
    Posts:
    6
    Sorry didn't realize that it was off by default. It is enabled now.

    -John
     
  16. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    PM send :)
     
  17. Anicus

    Anicus

    Joined:
    Jul 15, 2012
    Posts:
    14
    Hello
    I have a problem about your NodeCanvas plugin, when I right click on canvas it's only have 2 election menu "Action" and "Condition" I can't create other node. I follow your doc. and try a lot of time but It's also has only 2 menu. How can do for this issue?
    thank you.
    PS. I use unity4.3.4 and NodeCanvas 1.4.0 Mac OSX 10.9
    PS2. I purchased to day in a promotion price.
    $Screen Shot 2557-05-13 at 23.22.42.png
     
    Last edited: May 13, 2014
  18. nixter

    nixter

    Joined:
    Mar 17, 2012
    Posts:
    320
    Last edited: May 13, 2014
  19. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hello, It's an issue of the current NC version on OSX.

    I've PMed you the fix.

    Thank you! :)
     
  20. nuverian

    nuverian

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

    A Dialogue Tree can be started by calling StartGraph on the dialogue tree or one of it's overrided methods as seen in the documentation here :)

    By the way there is no reason to parent the dialogue tree under your capsule, as well as you don't have to add the DialogueActor on the dialogue tree. You can simply add the DialogueActor on the capsule.
    Furthermore there is also no reason to assign the 'current owner references' of the dialogue as you have done :)

    So the process is much simpler:

    1. Create the Dialogue Tree.
    2. Add the conversation actor names in that Dialogue Tree.
    3. Add the Dialogue Actor on your characters and give them their names.
    4. In the Dialogue Tree and on each node, select which of the actors is going to perform the node.
    5. Start the dialogue.

    Even with how you have setuped it, it will work, but you need to add the example UI prefab named @DialogueUI to handle the events.

    By the way, instead of using the Execute Function task, although it's correct, here is a simple Action that will start a dialogue tree and run for as long as the dialogue is running.

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using NodeCanvas.DialogueTree;
    4.  
    5. namespace NodeCanvas.Actions{
    6.  
    7.     public class StartDialogueTree : ActionTask {
    8.  
    9.         [RequiredField]
    10.         public DialogueTreeContainer dialogueTree;
    11.  
    12.         protected override void OnExecute(){
    13.  
    14.             dialogueTree.StartGraph(agent, blackboard, EndAction);
    15.         }
    16.     }
    17. }
    18.  
     
  21. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    The new version 1.4.3 which also fixes the context menus bug on OSX is now live.
    That was a good timing :)
     
  22. nixter

    nixter

    Joined:
    Mar 17, 2012
    Posts:
    320
    Ahh, thank you. The key thing I needed was the @DialogueUI. Now it seems to be working.
     
  23. Spyderworxs

    Spyderworxs

    Joined:
    Aug 21, 2012
    Posts:
    31
    Working much better now. Thanks.
     
  24. KidSicarus

    KidSicarus

    Joined:
    Feb 3, 2014
    Posts:
    35
    Hey, nuverian.

    We're looking for an AI solution for a networked 2.5D platformer . Will NodeCanvas satisfy our needs?

    Thanks and good luck on the sale.
     
  25. nuverian

    nuverian

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

    In NodeCanvas it doesn't matter whether the game is 2D, 2.5D or 3D as it doesn't in most AI solutions too :)
    The provided actions for pathfinding are using unity NavMesh solution, but as in most production you will be creating custom tasks to better satisfy the design goals.

    As far as networking goes, some people have already succeed in using NC with networking (ULink in their case). The reason of that being because NC is build using MonoBehaviours and as such there is all the functionality that you are familiar with when creating your custom tasks, so you are able to use RPC methods for example.

    Personaly I have little networking experience overal :)

    Let me know if you have more questions as of your game needs.
    Thank you
     
  26. jemstars

    jemstars

    Joined:
    Nov 7, 2013
    Posts:
    6
    I guess this is the place for questions.

    I created a simple plane with a navmesh, and simple object on the plane with a navmesh agent. Then created a simple behaviour tree, that waited for the space bar to get hit, then move (using "Move To") along the z axis, and then print out debug message to the console.

    It does wait for the space, and then it does move the cube to the desired location, however it never exits that action to then print out the message to the log.

    Any ideas?

    -John
     
  27. bkw

    bkw

    Joined:
    Sep 20, 2013
    Posts:
    49
    Minor issue, but it'd be nice if the version number in the editor updated on new versions. =) Be helpful as a reminder of what version is currently in the project.
     
  28. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Damn! How silly I am. In my haste of the fixing them in previous update, I've broken the code for the move actions instead :/

    To all. Please download the attached .zip archive and overwrite the 3 move actions found under NodeCanvas/Scripts/Tasks/Actions with the ones in the archive.

    View attachment $MoveActionsFix.rar

    I am sorry for this. I'm human :)


    Indeed. Something omitted. Thanks for reminder.
     
    Last edited: May 13, 2014
  29. jemstars

    jemstars

    Joined:
    Nov 7, 2013
    Posts:
    6
    No Worries! And thanks for the quick reply and fix.

    That fixed it! It now works as expected.

    Keep up the good work. So far really enjoying learning this plugin.

    -John
     
  30. nixter

    nixter

    Joined:
    Mar 17, 2012
    Posts:
    320
    Your NodeCanvas software seems well built. I've taken a few hours now to play around with it.

    I haven't found any way to use variables/tokens for the Dialogue Trees. It seems like all the dialogue is hard coded with no way to change the dialogue at runtime (without making custom nodes). Is this correct?

    Is it possible to use strings from a Blackboard for a Dialogue Text?

    And what is Meta Data used for?
     
    Last edited: May 14, 2014
  31. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Thank you. Let me know of anything :)


    Thanks :)

    In the last version of NodeCanvas 1.4.3 (current), you can use square brackets in the text of a Say node and a variable name within those brackets. eg:
    " I have completed [tasksCompleted] tasks "
    " My real name is actually [realName] "

    The variable value will be taken from the blackboard whatever that is and be shown ToString in place :)
    Sorry this is not possible in the demo because it's an older NC version 1.3 :/

    Is that what you mean?
     
  32. nixter

    nixter

    Joined:
    Mar 17, 2012
    Posts:
    320
    Yes, that is what I was looking for in the demo. Glad to hear it's in the new version.

    Is Meta Data related to the audio files?
     
  33. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Glad to know :)

    Metadata is simply a string as part of the dialogue statement that is send along with whom is making the 'statement' when a dialogue actor has to speak. Those events are send from the dialogue tree when they have to and then in turn those events along with the information is received most commonly by the UI to handle that information, like for example to show the text, play the audio etc.
    So metadata is simply some extra information that can be received by the UI to handle if and only that is necessary and is not related to audio files at all :)

    The example UI included doesn't make use of such information, but your own UI or another UI in general might do so.
    For example, maybe you'd like your own UI to also display a notification icon when the actor is saying that specific dialogue statement. This could be done by for example writing "info" in the metadata and then in the UI check that metadata and if is indeed "info" then show the UI icon. Just a silly example :)

    Hope I didnt confuse you :)
     
  34. nixter

    nixter

    Joined:
    Mar 17, 2012
    Posts:
    320
    No, it makes sense. I see how that could be useful with a UI designed to take advantage of it.

    Thanks for that explanation.
     
  35. yankijp

    yankijp

    Joined:
    Dec 10, 2012
    Posts:
    12
    Hi there!,

    I picked Node Canvas up. I created a new project, and I loaded the Solider BT demo. I tried switching the project to Windows Store Apps and doing a build but I get a bunch of errors unfortunately so it doesn't look like it is supported for Windows Store/Windows mobile.

    Thanks!
     
  36. bkw

    bkw

    Joined:
    Sep 20, 2013
    Posts:
    49
    What's the best way to force the tree to Tick?

    I want my AI to immediately respond to certain game events, but looking at how CheckEvent works, at best the AI will react at next Tick (which is every 0.25 seconds for me). I suppose a safe-ish way would be to some how to force intervalCounter pass updateInterval, but there doesn't seem to be a way to do so right now. (I'm trying to avoid modifying the NC classes so I can more easily integrate new versions)
     
  37. bkw

    bkw

    Joined:
    Sep 20, 2013
    Posts:
    49
    How easy is it to add your own BBValue type?

    It'd be nice to have a more specific type than "Component", and also a list of said Component.
     
  38. -JohnMore-

    -JohnMore-

    Joined:
    Jun 16, 2013
    Posts:
    64
    Hi :),
    I tried to read all the old posts but I may have missed a few, sorry if I ask something again.

    I am using NC to implement the player characters behaviour. I come from Playmaker so chances are I am not using NC correctly. For example in PM I call my methods in each state, executing them every frame, then I raise events to change states.

    In NC, I call my methods in the transition conditions and in the states I execute single actions:
    $NC_example.jpg

    HasJumped is a function of the player that returns True if the player has pressed the Jump button, while IsFalling and HasReachedFloor are functions from my physics module that return True if that is the current physic status. Inside the nested FSMs I do the same between Iddle and Moving states, I use HasMoved as a transition condition, and that function allows the player to move.

    Am I using NC correctly? Should I be using Behaviour Trees and not FSMs?


    My second question is, how can I prioritize transitions from states?
    $NC_transition_priority.jpg

    From the Jump FSM the player can either Double Jump or Hover, depending on the enabled stats, but it can have both at the same time in certain events. I could duplicate my flags, having on for canHover and another one for canDoubleJumpHover but since it is the same thing, just having priorities in the transitions should be enough.


    As I said I may (must) be using NC incorrectly so if that is the case I am sorry.

    Thanks!
     
  39. bkw

    bkw

    Joined:
    Sep 20, 2013
    Posts:
    49
    Can there be a way for action and condition tasks to get notified when the BT starts and stops running?

    Looking at CheckCSharpEvent, it adds the event handler on init, but it never removes it. I'd like for a way to add an event handler when the tree starts, and then remove the handler when the tree stops. Then I can also clear the "received" flag. It'd also be good to not listen to events while the tree isn't running so when the tree does start, it doesn't automatically have an event waiting.

    (Probably going to run into issues as well when a node does get an event, but it doesn't get ticked until much later, when the event is no longer relevant. Though I don't know how to solve this just yet.)
     
  40. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hello everyone. Sorry for the late replies! I was away.

    Hey there,
    Could you please share the nature of the errors? Unfortunately I can't build to such a platform but I would like to sort this out.
    Thank you.

    Yes, the CheckEvent as all conditions, is evaluated when the graph is ticked. If you want you AI to immediately respond then of course the most correct way would be to have an update interval of 0, meaning each frame.

    The easiest way to manualy tick a tree for an agent is to call Tick() on the BehaviourTreeOwner component. If the tree though is already running and you call Tick(), you will get a log that it is already running and it will not happen.
    Please comment out lines 41 to 44 in BehaviourTreeOwner to not get the warning and the Tick works even if the tree is already running.

    Is this what you are after?

    First, I'd like to clarify that there is difference in what a blackboard variable is and what a BBValue is.
    Blackboard variables are simply what is stored in the blackboard, while BBValues are objects that help in reading/writing to the blackboard or specifying a direct value to be used.

    Adding more supported types is not so automated right now and will require source code changes. I will work on making this more automated without this need.

    By the way, if you have a Component blackboard variable in which you have assigned lets say a script of type "Player" and you call GetDataValue<Player>(name) on the blackboard directly, then that Player component will be fetched as Player type.

    If the need is to explicitely use a BBValue to allow a selection in the task inspector only of a specific Component derived type from the blackboard, I can work on that on the next update. Please let me know if this is the needed case.

    Yes, a Component List would be usefull.

    Hello!

    You question whether you are best to use FSM or BTs is realy depnded on the type of behaviour you want to create. If your behaviour can be described in states when thinking about it, then using State Machines will be fine, but if it's more dynamic to a point that a state machine would become a spageti machine, then I believe Behaviour Trees would be the way to go.

    In my opinion the best aproach would be to mix both, with a broad state machine at the top level where each of the states is a more detailed Behaviour Tree, but that is a personal preference.

    Now regarding the usage, there are many ways to go about it really.To start with, your way of using Check Function, Execute Function is a valid one.

    But let's take for example the HasJumped transition's condition. The way I would go about it, would be to create a custom ConditionTask that simply returns true if the player has pressed the Jump button directly, without the need to Check a Function on the player script.
    Similarly, let's take the HasReachedFloor. You could create a custom ConditionTask that returns true when the player has reached floor, whatever that means for your game. So in essence you could move the code of HasReachedFloor from your player's script to a custom ConditionTask itself and reuse it whenever it's needed.

    Furthermore if you are used to Playmakers way of events, you can emulate this in NC as well:
    You can use the CheckEvent condition on the transitions, where you specify the event name and then within the action of a state call SendEvent(string eventName) like in Playmaker. In effect the transition will take place.

    For your last question about prioritize, that is something I've omited but it's a nice catch. I will add that in the next update. It's simply a matter of reordering the transitions listed in a node's inspector. I can send you a PM with the code needed before the update takes place if you want.

    Please let me know if you have more workflow questions or if I was completely off :)
     
    Last edited: May 14, 2014
  41. bkw

    bkw

    Joined:
    Sep 20, 2013
    Posts:
    49
    I might be able to make this work. I don't want to make changes to you source code, so I'll have to find a way to access the tree owner in a generic fashion (probably through the Agent...).

    Yeah, I want to add a type like "Player", since I pass that around quite a bit in my game. If can get that in, then it would make editing easier. Currently I'm exposing strings, then using GetDataValue/SetDataValue in code, but it's not so elegant, and I lose "type-checking" in the editor.
     
  42. bkw

    bkw

    Joined:
    Sep 20, 2013
    Posts:
    49
    I think you missed this question. =)

     
  43. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Yes. Exposing string and using them this way is certainly valid, although using BBValues is certainly more helpfull :)
    I will see to making it more automated the creation of custom BBValues then or a way to allow specific component derived types on a BBComponent field which should also work although the .value of it will then require casting.

    Currenlty the Tasks dont get notified in these cases, but it will be trivial to add this and thus I will :)
    You are right about your suggestions. I will fix that.

    By the way you can call a method on all graph's tasks by calling SendMessage(string method, object arg = null) on the GraphOwner. This is similar to unity's send message although not exactly. This might be a temporary solution for now.
     
  44. -JohnMore-

    -JohnMore-

    Joined:
    Jun 16, 2013
    Posts:
    64
    Thank you! That was very informative. The part about moving my code from my scripts to Conditional Actions is a good idea, it means coupling my code to NC so I usually take the reflection way but since I plan on using NC it is all good :). Also, since all enemies share these actions, it would be nice to reuse them in their AI trees.

    I have a lot of work before I need to really worry about transition priorities so don't worry about giving me a heads up, I'll wait for the update :).

    One last question, I have finally finished, simplified and cleaned the player FSM (see below). It has 3 main nested FSM (InFloor, InAir and an un-named FSM to the right), the rest is just calls and checks. I still have to add attack patterns (different between InFloor and InAir) and special moves (more of the same).

    $NC_player_fsm.jpg

    Inside the nested FSMs there is only 2 states Iddle and Moving, and transition checks to change between them (the same in all nested FSMs). Do you recomend I convert all this FSM to a behaviour tree? Maybe let the top FSMs (InFloor, InAir, InHover and soon InAttack and InSpecial) and make each one a nested Behaviour Tree?

    Also I think I have found a bug: with a FSM this size or bigger, I have trouble sometimes editing a transition or a state because most of the time there is some item below the panel with the info and when I click a dropdown the item below takes priority and changes the focus. For example to edit an item I have to select it, then pan to ensure the info panel has no items below.

    Thank you for your time.
     
  45. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    You are welcome.

    Yeah making custom contained task is a bit more the way to go. Reflection based tasks are still great if you already have some code somewhere and want to reuse that and even more usefull in getting/setting/checking properties.

    Regarding your question of converting the nested FSMs, although I am not exactly sure of your goals, I think it's just fine to leave them as nestedFSMs since only by describing them it's clear that there are 2 dinstictive states, Idle and Move inside them, thus an FSM is suitable.

    What I ment before of having a broad FSM at the top level and BTs as states would be best suited in say the following example:
    Say you have an FSM with 3 states: Idle, Fight, Work and conditions in which transitions happen between them.
    Then especialy the Fight and Work states could be a nested Behaviour Tree instead to better describe the state.
    Just an example.

    As far as converting this whole FSM in a Behaviour Tree, I think it will worth the try since as of now it seems quite spaget-ish :) due to the need of rapid changes and BT tend to not make this happen if designed correctly.

    Furthermore I would really recomment you to create custom Actions and Conditions specific to your game, that do more 'complete' tasks and thus minimize the need of lots of states or checks.

    Regarding the bug, yes that is a nasty known UI bug that is still there. Thanks for the reminder :)
     
  46. bkw

    bkw

    Joined:
    Sep 20, 2013
    Posts:
    49
    Thanks! Custom BBValue types would be great! (As well as Lists of Components. =) ). Also, is there a reason why you can't have a BBSystemObject? Too generic?

    So the only way to set/get a System.Object value from the BB is through GetDataValue/SetDataValue? Likewise we can't have lists of System.Objects?
     
    Last edited: May 15, 2014
  47. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    I've done some work on that. Here is a BBRigidbody for example. So when you use such a field, it will alow to either assign a rigidbody directly or select a blackboard variable from the blackboard that is of rigidbody type. This means any Component variable that has a rigidbody assigned.
    So to create your BBPlayer for example, you just need to create such a class and replace the type you see here with your type. This is the base template.

    Code (csharp):
    1.  
    2.     [Serializable]
    3.     public class BBRigidbody : BBValue{
    4.  
    5.         [SerializeField]
    6.         private Rigidbody _value;
    7.         public Rigidbody value{
    8.             get {return useBlackboard? Read<Rigidbody>() : _value ;}
    9.             set {if (useBlackboard) Write(value); else _value = value;}
    10.         }
    11.     }
    12.  
    This will take effect on the next update though.
    Again, this is not the same as what types the blackboard directly supports.

    Having a BBObject is quite possible and will allow a selection of object variables on the blackboard, but of course you will not be able to make assignments in the inspector. Still, I don't know if it has a practical use :)

    --EDIT--

    About List<object>, I think that couldn't offer much except at runtime and through code. But considering that List<object> is an object itself, you can just go ahead and do:
    SetDataValue("MyList", new List<object>());
    GetDataValue<List<object>>("MyList);

    If you SetDataValue with any type that is not supported by the blackboard it will be added as object.
    When you GetDataValue<T> the variable that it's actual value is of type T will be fetched.

    So if you do SetDataValue("myRB", rigidbody) a component variable will be added with that rigidbody.
    Later on if you call GetDataValue<Rigidbody>("myRB") that rigidbody will be fetched.

    If SetDataValue("myRect", new Rect()) an object variable will be added with that Rect
    then GetDataValue<Rect>("myRect") will fetch that rect.

    and so on :)
    ----
     
    Last edited: May 15, 2014
  48. bkw

    bkw

    Joined:
    Sep 20, 2013
    Posts:
    49
    I thought of something like this yesterday. This requires something to already be assigned to a Component type BB variable so it can determine the type right? I'll need to assign some dummy rigidbody if I wanted the Component variable to appear as "Rigidbody" type?

    I suppose my thought was that... if I wanted to assign something of Component type, say Rigidbody... I could use myBBComponent.value as Rigidbody and be very careful I don't assign something of "Collider" to that variable. If it wasn't something of Component type, like any other class, I could do something like mySystemObject.value as MyCustomClass. (Though I suppose even for Component sub-classes, I should be able to do something like mySystemObject.value as Rigidbody).

    You might be right that it doesn't offer much. The only thing that you get would be to able to select some data in the node inspector? All "type-checking" will still occur at run-time with the cast.

    Thanks for all your help and quick replies by the way. I'm trying to learn and sort things out with NC before I build my BTs so I don't break things later. =)
     
  49. -JohnMore-

    -JohnMore-

    Joined:
    Jun 16, 2013
    Posts:
    64
    Hi,
    sorry to bother you again.

    I think I messed up big time. After finished creating all my actions I have redone the PlayerBehaviour FSM with my custom actions. Everything was working great until I decided to re-categorize all my scripts so I could have them in subcategories:

    from
    Code (csharp):
    1. [ScriptCategory("3Heroes")]
    to
    Code (csharp):
    1. [ScriptCategory("3Heroes - Characters")]
    Now the FSM won't load, I'm trying to debug but still have not found anything. I am scared that even if I restore the script categories it won't work so I am just debugging. Is there something I can do that won't break it again?

    This is the error I am getting
    Code (csharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. NodeCanvas.ConditionsList.get_conditionInfo () (at Assets/NodeCanvas/Scripts/Core/Tasks/Conditions/ConditionsList.cs:26)
    3. NodeCanvas.ConditionTask.get_taskInfo () (at Assets/NodeCanvas/Scripts/Core/Tasks/Conditions/ConditionTask.cs:17)
    4. NodeCanvas.ConditionalConnection.OnConnectionGUI () (at Assets/NodeCanvas/Scripts/Core/Graph/ConditionalConnection.cs:70)
    5. NodeCanvas.ConnectionBase.DrawConnectionGUI (Vector3 lineFrom, Vector3 lineTo) (at Assets/NodeCanvas/Scripts/Core/Graph/ConnectionBase.cs:263)
    6. NodeCanvas.FSM.FSMNodeBase.DrawNodeConnections () (at Assets/NodeCanvas/Scripts/Systems/FSM/FSMNodeBase.cs:153)
    7. NodeCanvas.NodeBase.ShowNodeGUI () (at Assets/NodeCanvas/Scripts/Core/Graph/NodeBase.cs:375)
    8. NodeCanvas.NodeGraphContainer.ShowNodeGraphWindows () (at Assets/NodeCanvas/Scripts/Core/Graph/NodeGraphContainer.cs:621)
    9. NodeCanvasEditor.NodeGraphEditor.OnGUI () (at Assets/NodeCanvas/Scripts/Core/Graph/Editor/NodeGraphEditor.cs:81)
    10. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    Thanks
     
  50. cAyouMontreal

    cAyouMontreal

    Joined:
    Jun 30, 2011
    Posts:
    315
    I missed the sales ! The Behavior Designer is still on sales, any chance to get on sales back soon?
    I'm really looking to grab it anyway, but $30 is $30 :)