Unity | Create Behaviour Trees using UI Builder, GraphView, and Scriptable Objects [AI #11]

Поделиться
HTML-код
  • Опубликовано: 19 июн 2024
  • This video is an hour long epic into how to create behaviour trees using ui builder, graph view, and scriptable objects. UI Builder accelerates editor tool development by visual drag and drop editing. Scriptable objects are used for serialisation, and graph view is the same node graph backing used by shader graph.
    Project files available here!
    ► / thekiwicoder
    Follow Me:
    ► Discord: / discord
    ► Patreon: / thekiwicoder
    ► Twitter: / the_kiwicoder
    ► Instagram: / thekiwicoder
    ► TikTok: / thekiwicoder
    ► TheKiwiCoder: www.thekiwicoder.com/
    Kia ora! 0:00
    The behaviour tree: 3:54
    UI Builder Editor Window: 23:30
    Creating nodes: 35:35
    Creating edges: 47:55
    Inspector View: 1:04:00
    The Root Node: 1:09:19
    Runtime Instancing: 1:13:51
    Ka kite!: 1:19:48
    #unity #behaviourtrees #uibuilder #thekiwicoder
    Thank you!
    TheKiwiCoder
  • ХоббиХобби

Комментарии • 195

  • @lesarch
    @lesarch 2 года назад

    This is absolutely amazing! I'm halfway through as I'm writing this and everything so far is clear and straight to the point. Good job!

  • @heliomiranda9622
    @heliomiranda9622 2 года назад +4

    Dude, this is for sure the best Behaviour Tree tutorial for Unity I've ever seen. Freaking awesome job you made! Thank you very much for sharing it! :)

  • @ElSonk
    @ElSonk 2 года назад +2

    This is über awesome. Not only ended it my quest for a visual Behaviour Tree (did BTs by script, but it got out of hand/too complex) -- it also teached me how to use UI Bilder! Thanks a million!

  • @KotieDev
    @KotieDev 3 года назад +17

    Just finished watching this and I wish I had this available when I finished my AI for my game a few days ago hahah. Behaviour Trees are so powerful and I'd love to see this getting extended. Would be amazing to see you deal with a brain of some sort (like a Blackboard). Great tutorial :D

  • @kilikopela83
    @kilikopela83 4 месяца назад +1

    Man, this was a great watch. Appreciate all the effort this must have taken. I know it’s an old video at this point, but It’s still useful and relevant today!

  • @spikebor
    @spikebor Год назад +4

    If anyone don't see the grid background, you just missed the step set BehaviourTreeView > Flex >Grow=1 in the UI Builder Inspector

  • @Lastered
    @Lastered 5 месяцев назад +4

    if anyone is looking for the grid background style .uss formatting, here it is:
    GridBackground {
    --grid-background-color: rgb(40, 40, 40);
    --line-color: rgba(193, 196, 192, 0.1);
    --thick-line-color: rgba(193, 196, 192, 0.1);
    --spacing: 15;
    }

  • @rustedknight_
    @rustedknight_ 2 года назад +1

    I was trying to write this myself before discovering this video, and essentially made something like what you did.... But it wasn't as well made for sure. it worked, was perfectly usable, but was ultimately quite clunky. Looking at this.... it's better in just about every way. Props for making nodes so easy to write, too. I haven't seen many other behavior trees this simple and effective.

  • @insigpilot
    @insigpilot Год назад +2

    Dude... this was a sick breakdown of data structures and Unity features. Amazing and inspirational. This definitely gets the wheels turning!

  • @HadiLePanda
    @HadiLePanda 3 года назад +6

    I appreciate a ton your tutorials, especially the ones on the behaviour tree. They're very useful so thanks for sharing, and keep it up! :)

  • @Salloom99
    @Salloom99 10 месяцев назад

    The type of content you're doing is what makes me passionate about unity in general.
    I needed your videos for so long man ❤

  • @Assassin0314
    @Assassin0314 3 года назад +2

    Amazing tutorial! thanks for making this, Im looking for this kind of video for a while.

  • @PiyPowKachou
    @PiyPowKachou 3 года назад +1

    This is gold, I wish many more people would appreciate such tutorials, hopefully your channel will grow. This graph topic, UI Builder and UIToolkit information sources are really scarce, not even many Unity devs are aware that such tools exist.
    Not sure if you are going to follow up with these series, but any UIToolkit/GraphView/UI Builder tutorial will be appreciated at least by me and my friends :) Thanks!

    • @TheKiwiCoder
      @TheKiwiCoder  3 года назад +2

      Thank you! I’ve found the tools really great to use to far. Sometimes it feels a bit early days still.. but man its a dream to work with compared to what was there previously, even in its current state. Hoping to cover a bit more on this, stay tuned!

  • @LuRybz
    @LuRybz 2 года назад

    I want to go back to Unity because of your channel. This is pure gold.

  • @Stripe0022
    @Stripe0022 3 года назад +1

    Was following along in my own project and you were clear and to the point. I can't wait to see more on this series

    • @TheKiwiCoder
      @TheKiwiCoder  3 года назад +1

      Awesome 👏

    • @syedsadiq8631
      @syedsadiq8631 3 года назад +1

      @@TheKiwiCoder kiwi why are u not makeing amazing videos and I want to suggest to u that plz make "leader board " and "gun shop" plz kiwi

  • @GreenCrazyCatStudio
    @GreenCrazyCatStudio 2 года назад

    It's just great, thank you very much for your work!

  • @Multi1092
    @Multi1092 3 года назад +2

    Keep em coming! Great vids!

  • @TheHitchhiker
    @TheHitchhiker 2 года назад

    This is a very helpful tutorial and I really appreciate it. This editor's going to save me a ton of time.

  • @xetra1155
    @xetra1155 Год назад

    great video - thanks a lot. Not enough resources to the editor creation workflow and yours is very nice!

  • @rodrigodias4251
    @rodrigodias4251 2 года назад

    Thank you for this amazing tutorial. Really great, helped me a lot

  • @ferociousgames4196
    @ferociousgames4196 2 года назад

    This is amazing! Thank you so much

  • @GameDevGarage
    @GameDevGarage Год назад

    Thanks for super solid tutorials!

  • @tobias-stein
    @tobias-stein 11 месяцев назад

    Thank you for this, thats gold 🙏

  • @broganking9830
    @broganking9830 2 года назад

    First time seeing a Kiwi tutorial. I can finally understand the dialect! haha

  • @nuumi7813
    @nuumi7813 24 дня назад

    You are so good man! I couldn't find a better editor on the asset store lol

  • @peche87_gameDev
    @peche87_gameDev 3 года назад +1

    Excellent content and pacing to explain everything while you are doing it. Great job dude!
    It would be awesome if you make an extension while it is running and showing some color or selection effect when each node is running or a different color based on current node states.
    Also it could be even greater if it is applied on one of the enemies into the game to watch it on real action.
    Thanks for sharing this! :)

    • @TheKiwiCoder
      @TheKiwiCoder  3 года назад

      Thanks man great suggestions 😁

  • @generic.hybridity3136
    @generic.hybridity3136 Год назад

    Great Stuff!

  • @MrHandsy
    @MrHandsy 2 года назад

    THANK YOU SO MUCH, MAN!!!!

  • @user-lv2di6fo7b
    @user-lv2di6fo7b 11 месяцев назад

    太棒了!!!!!!跟着做了一遍基本已经知道原理了:>

  • @aninuji8882
    @aninuji8882 3 года назад +1

    I can't believe this is for free. Thank you so much! This is truly gold on pixels form.
    Btw, execute children 👀

  • @CGPOOP
    @CGPOOP Год назад

    Just wanted to say thank you, not sure if you are still creating videos for the channel but this was super helpful, the whole behavior tree aspect was really easy to use and I understood it quite well, the problem was when we got to the edges and getting that to work with everything else, even though its working I have to say I just copy pasted what you did without being able to understand half of it xD Regardless thank you, you seemed really knowledgeable and this is super useful content.

    • @TheKiwiCoder
      @TheKiwiCoder  Год назад

      Best resource for learning this is searching the Unity GitHub for everything graph view related

  • @ahmadgamal65
    @ahmadgamal65 Год назад

    Holy crap this the best tutorial ever made

  • @corymaklin7864
    @corymaklin7864 3 года назад

    Thank you!

  • @ashb899
    @ashb899 Год назад

    thank you so much for this, great effort. Also notice the tree view is still experimental a year later :P

  • @CameronOwen101
    @CameronOwen101 2 года назад +2

    Nice tutorial, hard to keep across all the new stuff being added to Unity. You should look into the new pattern matching features of C# - usable in Unity 2019+ and lets you combing casting and the if check into one line for example:
    if (parent is CompositeNode cn) {
    cn.children.Add(child);
    } else if (parent is Decorator Node dn) {...}
    Etc. Also much more expressive pattern matching with switches in C# 8 which is Unity 2021.1+.

  • @ShadowTM6
    @ShadowTM6 Год назад

    Amazing :)

  • @gameeverything687
    @gameeverything687 2 года назад +1

    Oh damn, I was literally making a behavior tree for editor FROM SCRATCH. I found this accidentally...wasn't even looking. THANKS

  • @AliceMonUnitydeveloper
    @AliceMonUnitydeveloper Год назад

    Thanks!

  • @d0c_dev
    @d0c_dev 3 года назад

    Bro thx a lot the tutorials are helping me a lot in making a very shitty but made by me fps, didn't totally copy your code because my game is quite a bit different than shown in the fps series, but still you helped me with nav mesh a lot, hope to make a video about how my game turned out soon

    • @TheKiwiCoder
      @TheKiwiCoder  3 года назад

      Awesome man that's great to hear. Looking forward to the trailer!

  • @filipeduraes3525
    @filipeduraes3525 Год назад +1

    Really nice video. One thing you forgot to implement is the order of execution depending on the node's y position. In this current state, the order will depend on the order that the connections were created, so if you wanted to change it, you'd have to delete and readd it. This could be fixed by looping through all children from the parent node when one of the children position gets changed (maybe optimizing by only doing the loop after the drag operation is over) and sorting it based on its y position (bigger y position gets positioned on top). Then it would probably perform correctly.

    • @TheKiwiCoder
      @TheKiwiCoder  11 месяцев назад +1

      Yes! I discovered this also after uploading. My solution was to sort the children anytime a nodes position is changed which has been working well

  • @francoisdelachapelle3468
    @francoisdelachapelle3468 Год назад

    Hello, great tuto there. Learned a lot. I have a question though. At 1:17:10 you clone the BT however when you clone the root you don't seem to have any problem while mine insist on me casting it to root otherwise it generates an error. It's strange since Root inherits from TreeNode as well...

  • @obsidian741
    @obsidian741 2 года назад

    I came here to learn behavior tree, but ended up learning quite a few about the UI Builder

  • @feliperibeirosilva900
    @feliperibeirosilva900 8 месяцев назад

    how do you know so much about the UI builder.kind of crazy. even more considering this video was done 2 years ago. neve seen someone type so fast code. I can't even keep up with the typing.
    relay great content and verry professional =)

    • @TheKiwiCoder
      @TheKiwiCoder  8 месяцев назад

      Haha! A lot of the unity source is up on github which contains a bunch of uitoolkit examples. Shader graph was a pretty useful reference

  • @melodysprout23456
    @melodysprout23456 7 месяцев назад

    Really nice video. This will help greatly with AI behavior. sure, but it will also make a great dialogue tree for individual characters. Thank you so much for the upload.

  • @maciejszczesnik9441
    @maciejszczesnik9441 2 года назад +2

    This is awesome! Also, I had to change how the BehaviourTree (the asset) stores the connections between nodes - I use a single array of all the nodes in the tree and save their indexes. I also save the parent/child indexes in the nodes themselves. This is a bit painful (it requires updating all the indexes with each node deletion/addition), but it makes it possible to copy the tree (by using CTRL+D in Project View). Before the connections between nodes (children) were removed after duplicating the tree. I think it would be way easier to find the nodes by GUIDs (always) and save the GUIDs of children nodes but saving indexes instead gives me rather quick access to the nodes in runtime. Or am I just stupid and there is a simple way to make it all work with object references when duplicating the asset in the Project View? :)

  • @beiliu-xd3lp
    @beiliu-xd3lp 5 месяцев назад

    大佬太强了🤩

  • @huntserston3579
    @huntserston3579 3 года назад +1

    This looks amazing and well done! Will you be updating the current enemy ai using this new behavior tree and showing other uses for it outside of enemy behavior and adding ones that go to a certain node based on if a condition is met or not?

    • @TheKiwiCoder
      @TheKiwiCoder  3 года назад +2

      Thanks! Yep I'll be developing this further as it's still pretty barebones now. The plan is to replace all of the current hardcoded logic with BT's, which hopefully will cover your example. Stay tuned!

    • @huntserston3579
      @huntserston3579 3 года назад

      @@TheKiwiCoder Sweet! Pretty excited to see what comes next!

  • @rocks892
    @rocks892 2 года назад

    Great video, I followed up on it but in case of deleting a node the OnGraphViewChanged event is not getting called although its getting called if I change position any idea?

  • @tommywilkinson33
    @tommywilkinson33 Год назад +9

    This is fantastic and I love having a visual way to setup my behaviour trees! I just want to add a few errors I ran into following this in case someone else experiences them as well: At 25:16 you say you change those two lines of code to just visualTree.CloneRoot(); and say it's not necessary but it absolutely is necessary for the window to work at all. I initially skipped this step but the window didn't show any of the features it did inside the editor preview. Also for the 44:52 bug where it throws a null reference error, even if I had the scriptable object selected in the project view I still got a null reference error and it never worked to add a node. I had to add the following code the BehaviourTreeView.cs in the CreateNode function after the if(tree) statement: else{ BehaviourTreeSO newtree = ScriptableObject.CreateInstance("BehaviourTreeSO") as BehaviourTreeSO;
    string path = $"Assets/DEBUGTREE.asset";
    AssetDatabase.CreateAsset(newtree, path);
    // AssetDatabase.AddObjectToAsset(newtree, newtree);
    AssetDatabase.Refresh();
    EditorUtility.SetDirty(newtree);
    AssetDatabase.SaveAssets();
    tree = newtree; } This let me create a new Behaviour Tree scriptable object in the code and save it so that the window could reference it. Oddly even with this if I just select a different one in the project view it doesn't seem to work. Maybe something changed with the OnSelectionChanged method you used earlier or something? But so far this is the only way I've found to get it to actually work.
    Edit: Shortly after posting this I was looking around still trying to find a solution for the second part: Unity didn't seem to acknowledge when you picked the scriptable object in the project view. Well now all of a sudden it works just fine without me changing anything... This isn't the first time Unity has done this to me :/

    • @TheKiwiCoder
      @TheKiwiCoder  Год назад

      I love it when people post extra information like this, thank you!

    • @NutBuster99
      @NutBuster99 10 месяцев назад

      The right way to add the node at that point of tutorial (44:52) is to open the actual window from the menu "BehaviourTreeEditor -> Editor ..." and then right click and add the node on it after selecting the scriptable object asset from the project menu due to the "OnSelectionChanged" method. Adding A Node On The "UI TOOLKIT WINDOW PREVIEW" Won't Work...This won't result in the null reference error.

    • @feliperibeirosilva900
      @feliperibeirosilva900 8 месяцев назад +1

      If is still not working delete the BehaviourTree Scriptable Object and create a new one. In some unity versions Scriptable Objects have a hard time Updating it self

  • @rovex_
    @rovex_ 2 года назад +1

    First of amazing tutorial! but I am using Unity 2020.3.x and found that on the version i was using (2020.3.3f1) that the UI tools asset gave errors. so i upgraded my project to 2020.3.16f1 (latest LTS) and it gives no errors. But all those fields on the top right of the UI Builder dont show up. it just shows an empty dropdown called attributes...
    So i cant changes anything in there like the label text for example.
    In your further tutorials (AI #12) you also use the UI debugger, that window doesnt show the hierarchy as it should, it just shows all those variables on top of each other in normal fields like the inspector.
    Now i cant progress since upgrading my project to 2021 isnt an option. any ideas?

  • @Arnazisti
    @Arnazisti 2 года назад

    Great stuff mate! Just curious if you know what would need to be done in order to create a kind of visual scripter from this? I'm using a form of behavior trees/tree map with costs and requirements - e.g. the root node is take a sip of a drink, below that is put the drink in your hand, and below that is either request a drink or steal it from someone if you have a certain trait.
    Currently it is quite a mess to create modifications and I'd like to create a visual aid which then creates the necessary code when saved. Maybe I'd be better off using ScriptableObjects? Hard to say.

    • @TheKiwiCoder
      @TheKiwiCoder  2 года назад +1

      Yeah you can repurpose this for something like you’re describing. Also checkout Bolt visual scripting system in Unity for some other options!

  • @user-jw4nt3qm6q
    @user-jw4nt3qm6q 2 года назад

    too sweet

  • @berkekadircelik6282
    @berkekadircelik6282 Месяц назад +1

    I dont know if you are still reading these, but I have a small question.
    I can delete the nodes by using the contextual menus delete button, which triggers the graphViewChange.elementsToRemove like normal.
    But when I use the delete button, nothing seem to happen. graphViewChange.elementsToRemove not seem to be detect any change.
    It is not a big problem but I am kinda curious why it doesnt happen, do I need to specifly listen for delete key?

  • @herohiralal3255
    @herohiralal3255 2 года назад

    Great tutorial. I noticed that you build every time you make a change in Visual Studio. That's actually not required, you can just save all files and switch back to Unity, the compilation will happen automatically. Actually it will happen regardless whether you build in Visual Studio. At least it is like that for me. I assume it works this way for you because pressing build automatically saves all files I think.
    On the same topic, you might want to move to Rider for Unreal Engine. It's still in public beta and also licenses you the product for commercial projects. It has a great Unity integration, and it also has auto-completion capabilities for UXML, USS, CG and HLSL.

    • @herohiralal3255
      @herohiralal3255 2 года назад

      I watched further in your video and holy crap, it's a really great tutorial. Thanks a lot for this. I have been working on a custom AI tool myself and using CustomEditor and IMGUI. I always wanted to make a graph editor but it always felt very daunting to me because I have done GraphView before and it was just a nightmare. Your methods are really simple and effective.

    • @TheKiwiCoder
      @TheKiwiCoder  2 года назад +1

      Thank you! I assume you meant Rider for Unity ;) I did try Rider for a while, but I think most people watching this channel are using VS so I'd prefer to keep the videos familiar in that regard. Thanks for the comments and good luck with your editor!

    • @herohiralal3255
      @herohiralal3255 2 года назад

      @@TheKiwiCoder no I mean Rider for Unreal. It's just called that because it's the fork meant to slowly add Unreal support. You can use it just fine with Unity too. All the main Rider features included.

  • @JohnTrustworthy
    @JohnTrustworthy 2 года назад +1

    Wow, I didn't know Anakin was just following a simple Sequencer Node.

  • @blitzkreig4887
    @blitzkreig4887 Год назад

    Do you know how to create Subgraph in GraphView ? To separate out the BT into modular chunks when it gets complex..

  • @TheSixoul
    @TheSixoul 2 года назад

    Discord link is dead. I keep having random issues with various parts. When I try keeping the position save all my nodes are invisible and I don't think I can properly delete nodes because they still show on the asset object but not in the graph

  • @forcepower7116
    @forcepower7116 3 года назад +1

    Hey man Here Are some idears on what you could include in this series
    1. Enemy attacking with fists or meele
    2. enemy’s take cover behind walls or objects
    3. food ik for the enemy’s so The walking up stairs or slopes looks better
    No need, just my suggestions for further idears
    I love this series so far

    • @TheKiwiCoder
      @TheKiwiCoder  3 года назад +1

      Thanks for the suggestions! A cover system would fit well in this series :)

    • @syedsadiq8631
      @syedsadiq8631 3 года назад

      @@TheKiwiCoder suggested 0.2 and I want this to my project so plz make it "gun shop" and leaderboad" plz kiwi

  • @Ariel16283
    @Ariel16283 Год назад +1

    I was getting an NullException when trying to create an node. It seems the BehaviourTree reference was not being set. For some reason it wasn't opening the runtime window, only on the UI Builder editor. I did a layout reset and it fixed. Hope it can help someone.

  • @lnguyenhuu6821
    @lnguyenhuu6821 2 года назад +1

    Thanks for the video! Almost finished but adding comments on the go one by one, not to forget them and so you can reply separately.
    1:07:51 You're hiding superfluous values in the Inspector View as we can either edit them graphically or they are state variables meant for runtime that we shouldn't edit.
    But in the case of the Sequencer Node, the child order is not obvious. It follows the edge creation order, but graphically nothing distinguishes the edges, so seeing the children sequence in the Inspector View may help. We can even rearrange the order there, although it's risky as we can also add/remove entries directly, which the GUI may not reflect unless we force updating the view.
    Ideally the edges would be numbered as with Unreal's Sequence nodes. It seems that currently, to distinguish output edges we must create N output edges of type Single, but that's not really convenient. Maybe later Unity will allow visualising ordered output ports and allow to dynamically add/remove them for better control.

  • @alvaro.makes.music1
    @alvaro.makes.music1 2 года назад

    Thanks for sharing this! By the way, do you know how to change the color of the node connectors via C#?

    • @TheKiwiCoder
      @TheKiwiCoder  2 года назад +1

      I was able to change certain states only.. sorry short answer no. It might be possible to write a custom edge type though

  • @heisarzola
    @heisarzola 2 года назад

    Been a while, but does anyone know how to make those node endpoints used to organize everything? The type that you get if you double click an edge on shadergraph.

  • @hardsmoke137
    @hardsmoke137 Год назад

    Sweet

  • @saulvilchez7031
    @saulvilchez7031 8 месяцев назад

    Hello, the vieos is amazing. However I got an error, when I update the nodes on the ui builder a paramater null reference error. this only happens if I edit the tree and clikc on run

  • @saadsarnaik
    @saadsarnaik 3 года назад

    Extremely useful guide. Thanks! Glad I found your channel. Also, I hope GraphView comes out of experimental.
    Edit: I tried using the default function Instantiate() while setting up the GraphView but it wouldn't display the graph panel when I tested it outside of UI Builder. CloneTree() worked but the documentation said it will be deprecated. Not sure why Instantiate() didnt work

    • @TheKiwiCoder
      @TheKiwiCoder  3 года назад +1

      This was the problem I had.. the default Instantiate creates a temporary intermediate container which all the xml elements are added as children. You can see this using the ui toolkit debugger. I had to set flex-grow to 1 for that temporary container to expand, and then the graph view would be shown as normal. I hope they don't remove CloneTree because it's pretty confusing having to do that.

    • @saadsarnaik
      @saadsarnaik 3 года назад

      @@TheKiwiCoder Yeah that is a strange fix. Apart from that, UI Builder and Toolkit have been a lot fun to play around with. Thanks again!

  • @Bobster536
    @Bobster536 Месяц назад

    Doing simmilar thing, except im building a Dialogue Tree, so each node has 3 possible anwsers (3 output nodes) and each leads to a different new dialogue node. In a way simpler design because im using only one type of node (each dialogue serves the same purpose), but having added challenge of managing 3 output ports per node instead of just 1.

  • @user-gl4id8nr8u
    @user-gl4id8nr8u 2 года назад

    太强了。

  • @rogerbusquetsduran5596
    @rogerbusquetsduran5596 2 года назад +2

    Careful with the CreateNode method, you're accepting any type and not checking if it is or not a Node. I would go with generics for this.
    public Node CreateNode() where T : Node
    This way when we try to call this with a non Node type it will raise an error in the IDE.

    • @SolonisRex
      @SolonisRex 2 года назад

      Good comment. A much better error to debug! :)

  • @josepmpujol1
    @josepmpujol1 2 года назад

    Where did you learn concepts related to GraphView?

  • @stvs9722
    @stvs9722 3 года назад +1

    Hello and thank you for teaching us those stuff...The question is...where did you learn them?

    • @TheKiwiCoder
      @TheKiwiCoder  3 года назад

      Thanks for watching! The official Unity github has been a great reference for this: github.com/Unity-Technologies/UnityCsReference

  • @vatyunga
    @vatyunga 3 года назад +1

    You could use:
    If(NodeType is DesiredNodeType result)
    result.DoSomething();
    Or even better you could use the strategy pattern.

    • @TheKiwiCoder
      @TheKiwiCoder  3 года назад

      Ohh man thank you! I was wondering what the c# syntax was. Cheers a mil!

    • @lnguyenhuu6821
      @lnguyenhuu6821 2 года назад

      Exactly, and it allows you to chain with else if to show that the Decorator, Composite, etc. cases are exclusive. Note that it's C# 7.0, but OK to use with Unity now.

  • @StarkTech47
    @StarkTech47 Год назад

    I have a question, why are you not using the node from Unity and use scriptable objects instead ? It seems more complex and it would avoid to have many scriptable objects for each node in each graph no ?

    • @TheKiwiCoder
      @TheKiwiCoder  Год назад

      Hey, could you dm me on discord with this? Keen to hear what you mean by node

  • @forbiddentree1679
    @forbiddentree1679 2 года назад +4

    How do you pass data between nodes? Great videos!

    • @TheKiwiCoder
      @TheKiwiCoder  2 года назад +1

      Thank you! Checkout the next video in the playlist for a simple blackboard implementation. This is the main method for passing data between nodes

    • @forbiddentree1679
      @forbiddentree1679 2 года назад

      @@TheKiwiCoder Thank you! I will take a look.
      Question: will you post more GraphView tutorials?

  • @KaspisVids
    @KaspisVids 2 года назад

    I tried folowing your tutorial but when I try to create graphview it says "element has no registered factory method.", while factory method is there, I basicaly copy pasted the code.

  • @CorleoBabar
    @CorleoBabar Год назад

    I get the split view to appear while previewing, but it doesn't appear in the actual editor window. Anyone else have the same issue?

  • @BLACKDREAMIO
    @BLACKDREAMIO Год назад

    brother plss help in my project it saying a directive is missing in the overlayview script
    i added
    using System;
    using UnityEngine.UIElements;
    using UnityEditor.Experimental.GraphView;
    then i tried using UnityEngine,UI;
    but none of these worked pls help

  • @whiterice6016
    @whiterice6016 2 года назад

    Is there documentation for this?

  • @pozer9378
    @pozer9378 2 года назад

    At what point did you actually create the BehaviorTree ScriptableObject? I get the error when you right click to create a node for the first time but there is not asset so I create one but even if I have it selected it still gives an error. It is referring to the CreateNode function in the BehaviorTreeView script, but the code has no errors. Any ideas?

    • @generic.hybridity3136
      @generic.hybridity3136 Год назад

      Hey there, I had this problem as well. I know this is probably far too late to help but if anyone else has this problem.
      In my case it had to do with Namespaces, in that I had added the Nodes/BehaviourTree to a separate namespace and I had to remove the namespace to get it to work. There is likely a way to resolve it without just removing the namespace but as of now i've abandoned the namespacing for putting these editors classes into the base namespace.

  • @t.devries296
    @t.devries296 2 года назад +3

    Masterful tutorial! Just a thought on creating that contextmenu at about 44. Rather than doing several loops per abstract type, why not a single loop on node with an "if(!type.IsAbstract)" before adding?
    var types = TypeCache.GetTypesDerivedFrom();
    foreach(var type in types) {
    if(!type.IsAbstract)
    evt.menu.AppendAction($"[{type.BaseType.Name}] {type.Name}", (a) => CreateNode(type));
    }

    • @manuelsoares4343
      @manuelsoares4343 2 года назад +2

      On another note on this instead of doing "[{type.BaseType.Name}] {type.name}" one can do "{type.BaseType.Name}/{type.name}" and it will generate a sub menu for each base type and then populate it with each individual type of that subtype

    • @milanstevic8424
      @milanstevic8424 Год назад

      First I though IsAbstract belonged to System.Reflection and that he chose not to go down that path deliberately, but no, Type.IsAbstract is System. He also didn't know about pattern matching. But it's a good tutorial nevertheless.

  • @hahas507
    @hahas507 Год назад

    29:30 I have a question here.
    When I open my BehaviorTreeEditor.uss,
    I don't have GridBackGround{ }. I only have Label { }. So I tried typing in GridBackGround code that you showed us in the video, but it didn't work..

    • @hahas507
      @hahas507 Год назад

      Nvm, I was doing it the wrong way.
      I was just stupid

  • @shouptikdey2089
    @shouptikdey2089 5 месяцев назад

    How to Make a Port connect to another Specific Port. Like Say if i want to Connect PORT A to PORT B only

  • @spider853
    @spider853 Год назад +1

    I wonder if the Sequencer shouldn't actually do a while loop over children instead of counter over each frame? For example if you have a behaviour check (IsInRange) then an Action (Attack), it will miss the attack by one frame after it will get in range

    • @user-cm6ux5si1x
      @user-cm6ux5si1x 5 месяцев назад

      I was wondering the same thing! After some research on the topic, I was still confused.
      Some said BeahaviourTree should not abort the lower priority at default. But most of the example of BehaviourTree I found, the sequancer just loop through all child node and immidiatly abort the lower priority node if higher priority node fails.
      I am realy curious on this topic. Would you mind shareing on your findings apond this question?

    • @spider853
      @spider853 5 месяцев назад

      @@user-cm6ux5si1x I think it depends on your intention, if a check is an action then you leave it with a delay, of not then you continue on the same frame

  • @ThunderCuber3
    @ThunderCuber3 3 года назад +4

    Great tutorial. Been following it along well however when i try to do DeleteElements(graphElements), it says I get a typecast error, saying i cant convert UQueryState to Ienumerable. Been investigating this for a bit now but not sure whats going on.

    • @TheKiwiCoder
      @TheKiwiCoder  3 года назад

      Possibly a missing namespace? Check if you have these: UnityEditor.UIElements, UnityEngine.UIElements, UnityEditor.Experimental.GraphView

    • @ThunderCuber3
      @ThunderCuber3 3 года назад +2

      @@TheKiwiCoder Hmm. I had checked all that. I had a feeling that it may be that I was still on 2020.3 so I upgraded but I also reinstalled Jetbrains rider at the same time, and one of those fixed it for me ... not sure which one ... Thx for the reply though

    • @TheKiwiCoder
      @TheKiwiCoder  3 года назад +1

      Nice man 👌

    • @aninuji8882
      @aninuji8882 3 года назад

      @@ThunderCuber3 Hi! I'm having the same problem... which version did you upgraded to? I'm on 2020.3.6f1
      Thanks😁

    • @ThunderCuber3
      @ThunderCuber3 3 года назад +1

      @@aninuji8882 I upgraded to the latest 2021 version

  • @hahas507
    @hahas507 Год назад

    39:57 I keep getting error here when you put graphElements
    'UnityEngine.UIElements.UQueryState'에서 'System.Collections.Generic.IEnumerable'(으)로 변환할 수 없습니다. [Assembly-CSharp-Editor]csharp(CS1503)

    • @hahas507
      @hahas507 Год назад

      Turns out my Unity version was the issue :(

  • @suvankarbiswas2922
    @suvankarbiswas2922 3 года назад

    That's an amazing tutorial ❤❤❤
    However, can we change the orientation of port from Horizontal to Vertical..???
    We can do Orientation.Vertical, but that will only change the rotation of the connection wire, not the port.
    I had searched in many forums, but not got the result..... Plsss help 😔😔

    • @TheKiwiCoder
      @TheKiwiCoder  3 года назад +3

      Hey thanks! You're right, the node orientation isn't as easy to change as the edge. Node has a second constructor which takes a path to a custom uxml file, call this from the NodeView constructor, then call UseDefaultStyling. Use the UI toolkit Debugger, to get the uxml for a node by selecting it in the editor window, paste the xml from the uxml dump in into a local file which you pass to the constructor. From here, you're in a good position to move things around, just make sure to keep the names to matching and everything should work :) Hope that helps!

  • @JH-uv7km
    @JH-uv7km 4 месяца назад +1

    using unity version 2022.3.19f1 , node deleting is not working.
    i can click the node and move it, but deleting doesn't work.
    so i had to add
    base.BuildContextualMenu(evt);
    in BuildContextualMenu function in behaviour tree view
    to click delete menu manually.

    • @Inryhk
      @Inryhk 3 месяца назад +1

      Can confirm. And deleting the Scriptable objects directly will throw error.
      Don't need entire base as most of those actions will not interface well with this you can just add under the createnodes in BuildContextrualMenu funciton
      evt.menu.AppendAction("Delete", (a) => DeleteSelection());

    • @JH-uv7km
      @JH-uv7km 3 месяца назад

      @@Inryhk Thank you! It works well

  • @cheesecakenl1980
    @cheesecakenl1980 7 месяцев назад

    Great video. I am really trying to follow along but Unity 2023.3.12f1 makes it so *** difficult with all sorts of bugs with the UI builder and experimental graph stuff. Seems I am coding more hacks then an actual behaviour tree UI :(

    • @TheKiwiCoder
      @TheKiwiCoder  7 месяцев назад

      You could try the latest on my GitHub, it’s evolved a bit further than this video but it should work with 2023 latest.

  • @user-yz5qh1fx2n
    @user-yz5qh1fx2n 3 года назад +1

    This tutorial is awesome.Can I share it on a Chinese website, Bilibili? I want to share this tutorial with more Chinese developers.

  • @Dazza_Doo
    @Dazza_Doo 2 года назад

    Is it me, or did you create a State Machine?

  • @tecumstudio
    @tecumstudio 2 года назад +1

    Hello. Your tutorial is really amazing. I have watched this video several times, read your code over and over again and am disappointed because I must have made a mistake somewhere that I cannot find. When I click on play the tree view window is completely empty, I don't understand. Do you have any ideas about this phenomenon? ;-)

    • @TheKiwiCoder
      @TheKiwiCoder  2 года назад

      Hm I do not. I would suggest debugging they populate tree function to see what’s happening there.

    • @arthurjvnb
      @arthurjvnb Год назад +2

      TeCum Studio, I don't know if you found what the problem was (I had it too), but for anyone following this tutorial and is having this issue, you just need to write inside BehaviourTreeEditor.css:
      visualTree.CloneTree(root);
      My mistake was that I forgot to put "root".

    • @lukasklingenberg1199
      @lukasklingenberg1199 Год назад +1

      @@arthurjvnb Bless people like you! I couldnt figure out what was happening xD

    • @arthurjvnb
      @arthurjvnb Год назад

      @@lukasklingenberg1199 hahaha glad I could help you :D

  • @adeveloper7184
    @adeveloper7184 3 года назад +1

    Man! you have taken eras for putting this one in ;)

    • @TheKiwiCoder
      @TheKiwiCoder  3 года назад +1

      It’s been a busy Month!

    • @adeveloper7184
      @adeveloper7184 3 года назад

      @@TheKiwiCoder I understand, by the way in third person shooter series. Please add crouch, crawl, vault, cover system, and inventory too if possible. It would be almost complete TPS controller.

  • @optix212
    @optix212 2 года назад

    I now know how Anakin Skywalker felt. Sometimes, in order to achieve greatness, you've got to execute some children.

  • @arthurjvnb
    @arthurjvnb Год назад

    Does someone know how to fix a bug where the last node never connects?
    I'm trying to replicate the Repeat Behaviour Tree, but the last WaitNode never save its connection after I close the Behaviour Editor. I'm out of clue :(

    • @ArdaHamamcoglu
      @ArdaHamamcoglu Год назад

      Hey, had the same problem. You might have missed this part like me.
      public List GetChildren(Node parent)
      {
      List children = new List();
      DecoratorNode decorator = parent as DecoratorNode;
      if (decorator && decorator.child != null)
      {
      children.Add(decorator.child); //!!!This was decorator not decorator child!!!
      }
      CompositorNode compositor = parent as CompositorNode;
      if (compositor)
      {
      return compositor.children;
      }
      return children;
      }

    • @ArdaHamamcoglu
      @ArdaHamamcoglu Год назад

      Oh and I called it compositor not composite just letting you know.

    • @arthurjvnb
      @arthurjvnb Год назад

      @@ArdaHamamcoglu thank you for giving an answer! :D

  • @alicewithalex
    @alicewithalex 2 года назад

    Hello, can I create some sort of curve editor using this?

    • @alicewithalex
      @alicewithalex 2 года назад

      I mean like unity default, but custom :) also, can somehow I use this in inspector ? I need draw current curve like in animation curve field

    • @TheKiwiCoder
      @TheKiwiCoder  2 года назад

      I think you might want to check out custom property drawers. Good luck’

  • @sadsadsad5000
    @sadsadsad5000 2 года назад +1

    its my first time using UI builder and i could follow the tutorial up to 35:35, the window shows ok in Ui builder but it shows blank in unity

    • @michaelsander2878
      @michaelsander2878 Год назад

      I'm also running into this issue. I'm using unity 2021.3.0f1

    • @michaelsander2878
      @michaelsander2878 Год назад

      Okay I figured out what I did wrong. In the BehaviorTreeEditor: EditorWindow class I had an issue where instead of visualTree.CloneTree(root); I left out root and only had visualTree.CloneTree(); I hope this helps anyone else making the same mistake.

    • @PaulMucci
      @PaulMucci Месяц назад +1

      ​@@michaelsander2878I was following this tutorial and a lot has changed so I was stumbling on the changes with attributes. I made this mistake also. Thanks. Couldn't figure out if I was doing something wrong or the API changed too much to follow this anymore. Especially with the lack of docs and a lot of back and forth on what to actually use.

  • @alikum61
    @alikum61 2 года назад

    I really like your videos, but those keystroke sounds... Completly distract my focus. I guess you can use RTX Voice. Great content, thanks :)

    • @TheKiwiCoder
      @TheKiwiCoder  2 года назад

      Thanks for the feedback! I need better editing skills 😜

  • @songhaoli304
    @songhaoli304 2 года назад

    I know probably nobody else made the same mistake I made. If you update your project from an older unity version (in my case, 2020.4 LTS) and try to use UI builder. The attributes for any visual elements will not show up.

    • @satypardus9273
      @satypardus9273 2 года назад

      It's a known bug. They are working on it. Meanwhile you can downgrade the UIBuilder version to get the functionality back

  • @riekumar6999
    @riekumar6999 2 года назад

    Can this manipulate scene objects?

    • @Weckacore
      @Weckacore 2 года назад

      unity has built in options to access selected, so maybe that is worth looking into?

    • @TheKiwiCoder
      @TheKiwiCoder  2 года назад

      If you mean scene objects at runtime then yes you can add a tag field or name as a node property to find The object at runtime. It’s not possible to assign a scene object reference directly to a scriptable object tho.

  • @mailmaxxxx
    @mailmaxxxx 2 года назад +1

    Only 20 minutes in so far, and enjoying it - but had to pause to comment - you should change the title to "How to execute children" - you're bound to get more viewers! (not necessarily the sort you want, but still...)

    • @mailmaxxxx
      @mailmaxxxx 2 года назад +1

      Awesome - finished it and can't wait for more - learned so much! Thanks!

  • @Weckacore
    @Weckacore 2 года назад +2

    I am NOT making a behavior tree but by god if this isnt the best (only?) quality tutorial on graph view.