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. msl_manni

    msl_manni

    Joined:
    Jul 5, 2011
    Posts:
    272
    New GUI and other enhancements, Thanks for the update. )
     
  2. _met44

    _met44

    Joined:
    Jun 1, 2013
    Posts:
    633
    Many options I've been wishing to be there, and it seems you read in your customers mind ^^.

    This seems awsome, can't wait to get my hands on it !
     
    Danirey likes this.
  3. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Cheers to you too!

    You are welcome :)

    Hey,
    Very glad to hear that. I certainly don't have mind reading abilities :)
    Feel free to post any further ideas you might be missing.
    Cheers!
     
  4. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    The new version is now live :)
     
    Danirey, msl_manni and _met44 like this.
  5. msl_manni

    msl_manni

    Joined:
    Jul 5, 2011
    Posts:
    272
    Cannot alter the valueB of SetEnum or CheckEnum. The valueB always remain at the first option of the Enum. Please fix it.

    And how to create custom enums so that it can be used in the BlackBoard. Thanks.
     
    Last edited: Sep 10, 2014
  6. nuverian

    nuverian

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

    Indeed. Here is the fix. Please alter OnTaskInspectorGUI in both SetEnum and CheckEnum to this:
    Code (CSharp):
    1.  
    2.             EditorUtils.BBVariableField("Value A", valueA);
    3.            
    4.             if (!valueA.isNull){
    5.                 (valueB as IMultiCastable).type = valueA.value.GetType();
    6.                 EditorUtils.BBVariableField("Value B", valueB);
    7.             }

    For any type to show up for selection in any type selection menu you need to first add it to the commonly used types for your project through the Type Configurator window "Window/NodeCanvas/Configure Types".

    When you click "Add New Type" in that window you can browse through classes, interfaces and enumrations and add it to the list.
    By default the only enum contained in the list is the NodeCanvas.Status one and that's why it's the only one showing up when setting the type of an enum blackboard variable.
    Change the list as you wish. Your custom type will be in the 'Assembly-CSharp' category.


     
  7. msl_manni

    msl_manni

    Joined:
    Jul 5, 2011
    Posts:
    272
    Thanks for fix. :)

    One more thing. How can I get the option into a string var.

    if
    public enum MSL {Apple, Orange, Bannana}

    public string temp;

    then temp = Orange and as such.

    Thanks.
     
  8. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    You can use this task to get any blackboard variable .ToString()

    Code (CSharp):
    1. using UnityEngine;
    2. using NodeCanvas.Variables;
    3.  
    4. namespace NodeCanvas.Actions{
    5.  
    6.     [Category("✫ Blackboard")]
    7.     public class GetToString : ActionTask {
    8.  
    9.         public BBVar variable;
    10.         [BlackboardOnly]
    11.         public BBString toString;
    12.  
    13.         protected override void OnExecute(){
    14.  
    15.             toString.value = !variable.isNull? variable.value.ToString() : "NULL";
    16.             EndAction();
    17.         }
    18.     }
    19. }
     
    hopeful likes this.
  9. msl_manni

    msl_manni

    Joined:
    Jul 5, 2011
    Posts:
    272
    Thanks very much for the code. :)
     
  10. tomi-trescak

    tomi-trescak

    Joined:
    Jul 31, 2013
    Posts:
    78
    Gavalakis, for some reason I cannot scroll the content in the editor. One of my actions is hidden and I cannot get to it nor delete it. Another thing is, that in this action I insert rather large text into blackboard what made this hidden action visually huge what resulted into editor going a bit crazy and then hiding this action to the far left. These problems are on Mac. Here is a screen shot:

     
  11. tomi-trescak

    tomi-trescak

    Joined:
    Jul 31, 2013
    Posts:
    78
    And one more question. How would you approach implementation of camera fade out? Is it possible? From the ActionTask I cannot access the OnGUI phase. Thanks!
     
  12. nuverian

    nuverian

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

    Do you mean that for some reason you can't pan the nodes around with the middle mouse btn?
    I can add a max limit to the summary info that is showing within a node.

    You can use OnGUI as you normaly would in an ActionTask, but it will be called only for as long as the action is running.
    In the case of FadeIn thats ok, but in the case of a FadeOut it's not, since the screen will show black only for the duration that the action will be running. In other words you won't be able to do other stuff while the screen is faded out/black. If that is not a problem, then you can do the fades into the action task.
    If it is, another aproach would be to create a MonoBehaviour that manage the fades and simply call it from within an action task:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class CameraFader : MonoBehaviour {
    5.  
    6.     private static CameraFader _current;
    7.     private float alpha = 0;
    8.     private Texture2D _blackTexture;
    9.  
    10.     public static CameraFader current{
    11.         get
    12.         {
    13.             if (_current == null)
    14.                 _current = FindObjectOfType<CameraFader>();
    15.             if (_current == null)
    16.                 _current = new GameObject("_CameraFader").AddComponent<CameraFader>();
    17.             return _current;          
    18.         }
    19.     }
    20.  
    21.     private Texture2D blackTexture{
    22.         get
    23.         {
    24.             if (_blackTexture == null){
    25.                 _blackTexture = new Texture2D(1,1);
    26.                 _blackTexture.SetPixel(1,1,Color.black);
    27.                 _blackTexture.Apply();
    28.             }
    29.             return _blackTexture;
    30.         }
    31.     }
    32.  
    33.     public void FadeIn(float time){ StartCoroutine(CoroutineFadeIn(time)); }
    34.     public void FadeOut(float time){ StartCoroutine(CoroutineFadeOut(time)); }
    35.  
    36.     IEnumerator CoroutineFadeIn(float time){
    37.         alpha = 1;
    38.         while (alpha > 0){ yield return null; alpha -= (1/time) * Time.deltaTime; }
    39.     }
    40.  
    41.     IEnumerator CoroutineFadeOut(float time){
    42.         alpha = 0;
    43.         while( alpha < 1){ yield return null; alpha += (1/time) * Time.deltaTime; }
    44.     }
    45.  
    46.     void OnGUI(){
    47.        
    48.         if (alpha == 0)
    49.             return;
    50.  
    51.         GUI.color = new Color(1,1,1,alpha);
    52.         GUI.DrawTexture(new Rect(0,0,Screen.width, Screen.height), blackTexture);
    53.     }
    54. }

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. namespace NodeCanvas.Actions{
    5.  
    6.     public class CameraFade : ActionTask {
    7.  
    8.         public enum FadeAction{
    9.             FadeIn,
    10.             FadeOut
    11.         }
    12.         public FadeAction fadeAction;
    13.         public float fadeTime = 1;
    14.  
    15.         protected override string info{
    16.             get {return fadeAction.ToString();}
    17.         }
    18.  
    19.         protected override void OnExecute(){
    20.             if (fadeAction == FadeAction.FadeIn)
    21.                 CameraFader.current.FadeIn(fadeTime);
    22.             else CameraFader.current.FadeOut(fadeTime);
    23.         }
    24.         protected override void OnUpdate(){
    25.             if (elapsedTime >= fadeTime)
    26.                 EndAction();
    27.         }
    28.     }
    29. }

    :)
     
  13. tomi-trescak

    tomi-trescak

    Joined:
    Jul 31, 2013
    Posts:
    78
    You are no less than a king ;) Thanks a lot!
    For the canvas panning, would you consider panning also with something else than middle mouse button (e.g. ALT+left click). It's just that many Mac users have a magic mouse which magically does not have a middle mouse button.

    Thanks!


     
  14. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey. You are welcome, and thanks :)
    You can already pan all nodes with SHIFT+Click on canvas ;)
    Reminder: SHIFT+Click on node pans the brach

    Cheers!
     
  15. Cheshire Cat

    Cheshire Cat

    Joined:
    Sep 18, 2012
    Posts:
    39
    Hey, I'm considering to buy your asset, the only thing that prevents it for now is the Unity 4.5.1 requirement. I'm working with 4.3.4 version right now, and would like to avoid a mess of upgrading the version. Is it possible to get the last version which will work on Unity 4.3.4?
    Thanks.
     
  16. nuverian

    nuverian

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

    I took another look at the unity realease notes to make sure that I don't use anything that is 4.5 only in NC, so you won't have any problems working with Unity 4.3.4.

    I dont't have 4.3.4 installed as to be 150% sure, but if you do get it and there is such a thing, I will definetely make it work with 4.3.4.

    Thanks for your interest in NC :)
     
  17. Cheshire Cat

    Cheshire Cat

    Joined:
    Sep 18, 2012
    Posts:
    39
    Hmm, the problem is that Assets Store enforces the minimal required version and does not allow to buy if the requirement is not meet. Couldn't you check NC on Unity 4.3.4 and decrease the minimal required version in the store? I'm sure I'm not the only one which has that relatively fresh Unity version and the upgrade is not an option for him.
     
  18. nuverian

    nuverian

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

    I see.
    The minimum requirements are not set manualy, but rather are based on the version one submit the asset with.
    I could submit the next version with 4.3.4 or less so that the asset store reflect the minimum requirement.
    Cheers!
     
  19. Cheshire Cat

    Cheshire Cat

    Joined:
    Sep 18, 2012
    Posts:
    39
    Great, when do you think you going to do that?
     
  20. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    I will commit a new version tomorrow ;)
     
  21. George_Muse

    George_Muse

    Joined:
    Aug 26, 2014
    Posts:
    1
    I am using node canvas on my mac, and I seem to be running into some problems after pulling the update. The Execute Function's Select Method list is grayed out. Maybe I just don't have something hooked right, but I'm pretty sure everything is together. I was wondering if this had anything to do with the update itself. Thanks!
     
  22. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hello,
    Everything is fine on your part. There is a MAC issue with the context menu. Here is the fix until the new version goes live:
    Please Remove this code in EditorUtils.cs at line #936 under GetMethodSelectionMenu.

    Code (CSharp):
    1. if(!separatorAdded&&method.DeclaringType!=type){
    2.        menu.AddSeparator(TypeName(type)+"/");
    3.        separatorAdded=true;
    4. }

    Thanks!
     
  23. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hello everyone! New version is submited. Not a very fancy release, but still some important things:

    Version 1.5.9 Changes
    • Runtime reflection calls (Execute,Get,Set,Check Functions & Properties, Property Binder etc) are now direct delegate calls, super improving the performance (almost 20x).
    • Improved Canvas & Nodes UI graphics to have more contrast and thus be more readable.
    • The Switch Composite node now works much better (workflow wise) with enums, with the connections showing each "case" (screen bellow), making it even easier to re-create state-like behaviours within Behaviour Trees.
    • Similarily the Probability Selector, shows the chances per child node on the connections instead of within the node UI.
    • The Accessor Decorator will now read if it is set to 'Dynamic' or not like the rest of the dynamic nodes.
    • Show Comments is now a global option under the 'Options' dropdown.
    • The 'Auto Connect' options has been removed.
    • 'Defined Graph Parameters' info UI will now show for FSMs as well.
    • Properties will no longer show in the inspector.
    • Fixed: Overrided agent parameter will now show in 'Defined Parameters' info UI.
    • Fixed: NC taking control over AnimatorMove in some cases.
    • Fixed: SetEnum/CheckEnum tasks.
    • Fixed: Action tasks that in some rare cases were keep running after an interruption.
    • Fixed: Mac context menu for when selecting methods/properties/fields.
    • Fixed: Move action tasks when destination was Vector3.zero.
    • Fixed: Remapper not remaping 'Failure to Inactive' correctly.

    Switch.png
    Switch Composite based on enum & UI
     
    Last edited: Sep 26, 2014
  24. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Letting everyone know that the new version is now live :)
     
  25. msl_manni

    msl_manni

    Joined:
    Jul 5, 2011
    Posts:
    272
    Please add feature to copy-paste BlackBoard variables - selected/all and also variable values to different a BlackBoard. It is very time consuming to recreate all those variables and values on different BlackBoards. In some cases the number of variables on each BlackBoard are more than 50+.

    Thanks in Advance. :)
     
  26. msl_manni

    msl_manni

    Joined:
    Jul 5, 2011
    Posts:
    272
    Could you please give some Info whether we can have copy-paste BlackBoard variables? Or do I have to recreate them for all BB's. Waiting for reply.
     
  27. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey,
    Sorry for late reply.
    Yes, I can add a copy/paste variables in the context menu of the component for the next version :)
    By the way, if you are to use exactly the same variables in more than one graph, you can as well use the one and the same blackboard for all.
     
  28. msl_manni

    msl_manni

    Joined:
    Jul 5, 2011
    Posts:
    272
    The variables are not of static nature but their value are altered at runtime. These are local variables. For static variables I use GlobalBB. :)

    Or is the same BB instantiated at runtime for each agent?

    I use GetDataValue and SetDataValue to alter values of other collider BB, so it needs BB to be on the other collider itself. Am I right?
     
  29. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey,
    I see. Then indeed you would need one per agent, if they are of "local nature" :)
    You are correct. The fact that you can use the same BB in more than one agent was more of a reminder than suggestion, just in case :)

    Cheers!
     
  30. bhads44

    bhads44

    Joined:
    Feb 19, 2013
    Posts:
    37
    Hi,
    Is there a video of NodeCanvas in use, an overview or tutorial?
    Can anybody post a link if there is.

    Thanks.
     
  31. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hello,
    There are no videos, but you can find extensive online documentaion at http://nodecanvas.com/documentation/ :)
    As always feel free to ask anything.

    Cheers!
     
  32. msl_manni

    msl_manni

    Joined:
    Jul 5, 2011
    Posts:
    272
    Waiting for copy-paste BlackBoard variables. When is the next update coming? :)
     
  33. nuverian

    nuverian

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

    I will commit the next update in the weekend :)
    Cheers!
     
  34. RyuMaster

    RyuMaster

    Joined:
    Sep 13, 2010
    Posts:
    468
    Hi! If the latest version with blackboard copy/past is ready?
     
  35. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hello,
    Yes the new version is submited which includes this functionality. Here is what's new overal:

    • Unity 5 support (except iTween actions since it's based on iTween).
    • Global Blackboard Variables will now show up for when selecting override agent of task.
    • Added Blackboard copy/paste variables in Blackboard components context menu.
    • Implemented Action Task now accepts 1 parameter. Super useful.
    • BT Parallel node has an extra policy option as requested by a user, FirstSuccessOrFailure (This means that the parallel will break as soon as the first child task returns anything but Running).
    • Fix WP8 build error
    • Fix runtime agent/behaviour binding which was an issue if you directly Tick a behaviour tree instead of calling StartBehaviour in some cases

    Cheers and have fun! :)
     
  36. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Why do you use iTween?. It's not the best tweener !! :confused:
     
  37. nuverian

    nuverian

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

    I remember you've asked me this a couple of posts before :)
    I don't use iTween internaly. There is just a tweening action pack included that use iTween and that's all about it. You can even delete it if you don't want iTween in your project. It's just a third party support.
     
  38. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
  39. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    The new version is now live.
    Cheers!
     
  40. msl_manni

    msl_manni

    Joined:
    Jul 5, 2011
    Posts:
    272
    • Added Blackboard copy/paste variables in Blackboard components context menu.
    Its not showing up in context menu, or I cant find it.
     
  41. Pajaroide

    Pajaroide

    Joined:
    Sep 19, 2012
    Posts:
    34
    Hello Nuverian! I wanted to know if you're planning a sale in the near future? I'm interested in nodeCanvas but it's currently out of my budget. :rolleyes:
     
  42. nuverian

    nuverian

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

    It's in the component's gear context menu as shown in the image.

    contextMenu.png

    Hello,

    Putting an asset in sale also requires Unity to actually do it after author makes a request. I've made a request for putting NC in a sale, but it depends on Unity team for if and when this is done :)
    Thanks for your interest.
     
    Pajaroide likes this.
  43. cparki3

    cparki3

    Joined:
    Jan 13, 2014
    Posts:
    41
    This looks friggin amazing and I want to get it. Went to nodecanvas.com and the site looked like it was down? :( I saw the comment about it going on sale too and I'm wondering if maybe I should wait?

    Thanks!
     
  44. Pajaroide

    Pajaroide

    Joined:
    Sep 19, 2012
    Posts:
    34
    There's no guarantee of a sale, is up to Unity HQ... it could be in a month, or two or three. I would buy it right now if I had the cash.
     
  45. cparki3

    cparki3

    Joined:
    Jan 13, 2014
    Posts:
    41
    Good call @Pajaroide! I'll make you a deal @nuverian. As soon as the documentation is back up at nodecanvas.com I will buy it regardless of what price point it's at :)
     
  46. Pajaroide

    Pajaroide

    Joined:
    Sep 19, 2012
    Posts:
    34
    The site was up yesterday :eek: weird.
     
  47. cparki3

    cparki3

    Joined:
    Jan 13, 2014
    Posts:
    41
    Yeah I was going through their documentation last night. Plan was to download today and mess around with it. I want to make sure I have that resource before I move forward.
     
  48. nuverian

    nuverian

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

    I am sorry for the website being down at the moment. I am trying to fix this with my host company. I will post here as soon as it gets online, and hopefuly within a few hours.

    Thanks for understanding.
     
    mBeierl, Pajaroide and cparki3 like this.
  49. Vectrex

    Vectrex

    Joined:
    Oct 31, 2009
    Posts:
    267
    While the website is coming back up, I'll post here.
    There's a small problem with Unity 5 beta 11 after the update. I deleted the NC folder and updated. Importing pops up the 'API Update required' dialogue for the ITween stuff. Deleted them.

    This one happens when using the 'C Sharp Event' condition. Seems to happen with events with no parameters and ones with parameters (eg EventHandler type). Tested with a blank project.

    Code (CSharp):
    1.  
    2. public class EventTest : MonoBehaviour
    3. {
    4.     public delegate void Simple();
    5.     public event Simple OnSimpleTest = delegate { };
    6.  
    7.     void Update ()
    8.     {
    9.         OnSimpleTest();
    10.     }
    11. }
    12.  
    upload_2014-11-2_2-13-10.png
     
    Last edited: Nov 2, 2014
  50. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,459
    Correct if I'm wrong. I think the authors of each package can make their own private sales at any time. Because it's not an official sale promoted by unity, the authors have to tell their customers via the forum and elsewhere. There are many assets that have done this. For example, global illumination proxy https://www.assetstore.unity3d.com/en/#!/content/21197