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 Хобби
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!
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! :)
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!
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
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!
If anyone don't see the grid background, you just missed the step set BehaviourTreeView > Flex >Grow=1 in the UI Builder Inspector
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;
}
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.
Dude... this was a sick breakdown of data structures and Unity features. Amazing and inspirational. This definitely gets the wheels turning!
Booya!
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! :)
Thank you!
The type of content you're doing is what makes me passionate about unity in general.
I needed your videos for so long man ❤
Amazing tutorial! thanks for making this, Im looking for this kind of video for a while.
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!
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!
I want to go back to Unity because of your channel. This is pure gold.
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
Awesome 👏
@@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
It's just great, thank you very much for your work!
Keep em coming! Great vids!
This is a very helpful tutorial and I really appreciate it. This editor's going to save me a ton of time.
great video - thanks a lot. Not enough resources to the editor creation workflow and yours is very nice!
Thank you for this amazing tutorial. Really great, helped me a lot
This is amazing! Thank you so much
Thanks for super solid tutorials!
Thank you for this, thats gold 🙏
First time seeing a Kiwi tutorial. I can finally understand the dialect! haha
You are so good man! I couldn't find a better editor on the asset store lol
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! :)
Thanks man great suggestions 😁
Great Stuff!
THANK YOU SO MUCH, MAN!!!!
太棒了!!!!!!跟着做了一遍基本已经知道原理了:>
I can't believe this is for free. Thank you so much! This is truly gold on pixels form.
Btw, execute children 👀
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.
Best resource for learning this is searching the Unity GitHub for everything graph view related
Holy crap this the best tutorial ever made
Thank you!
thank you so much for this, great effort. Also notice the tree view is still experimental a year later :P
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+.
Amazing :)
Oh damn, I was literally making a behavior tree for editor FROM SCRATCH. I found this accidentally...wasn't even looking. THANKS
Thanks!
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
Awesome man that's great to hear. Looking forward to the trailer!
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.
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
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...
I came here to learn behavior tree, but ended up learning quite a few about the UI Builder
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 =)
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
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.
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? :)
大佬太强了🤩
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?
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!
@@TheKiwiCoder Sweet! Pretty excited to see what comes next!
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?
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 :/
I love it when people post extra information like this, thank you!
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.
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
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?
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.
Yeah you can repurpose this for something like you’re describing. Also checkout Bolt visual scripting system in Unity for some other options!
too sweet
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?
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.
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.
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!
@@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.
Wow, I didn't know Anakin was just following a simple Sequencer Node.
Do you know how to create Subgraph in GraphView ? To separate out the BT into modular chunks when it gets complex..
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
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
Thanks for the suggestions! A cover system would fit well in this series :)
@@TheKiwiCoder suggested 0.2 and I want this to my project so plz make it "gun shop" and leaderboad" plz kiwi
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.
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.
Thanks for sharing this! By the way, do you know how to change the color of the node connectors via C#?
I was able to change certain states only.. sorry short answer no. It might be possible to write a custom edge type though
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.
Sweet
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
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
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.
@@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!
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.
太强了。
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.
Good comment. A much better error to debug! :)
Where did you learn concepts related to GraphView?
Hello and thank you for teaching us those stuff...The question is...where did you learn them?
Thanks for watching! The official Unity github has been a great reference for this: github.com/Unity-Technologies/UnityCsReference
You could use:
If(NodeType is DesiredNodeType result)
result.DoSomething();
Or even better you could use the strategy pattern.
Ohh man thank you! I was wondering what the c# syntax was. Cheers a mil!
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.
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 ?
Hey, could you dm me on discord with this? Keen to hear what you mean by node
How do you pass data between nodes? Great videos!
Thank you! Checkout the next video in the playlist for a simple blackboard implementation. This is the main method for passing data between nodes
@@TheKiwiCoder Thank you! I will take a look.
Question: will you post more GraphView tutorials?
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.
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?
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
Is there documentation for this?
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?
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.
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));
}
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
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.
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..
Nvm, I was doing it the wrong way.
I was just stupid
How to Make a Port connect to another Specific Port. Like Say if i want to Connect PORT A to PORT B only
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
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?
@@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
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.
Possibly a missing namespace? Check if you have these: UnityEditor.UIElements, UnityEngine.UIElements, UnityEditor.Experimental.GraphView
@@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
Nice man 👌
@@ThunderCuber3 Hi! I'm having the same problem... which version did you upgraded to? I'm on 2020.3.6f1
Thanks😁
@@aninuji8882 I upgraded to the latest 2021 version
39:57 I keep getting error here when you put graphElements
'UnityEngine.UIElements.UQueryState'에서 'System.Collections.Generic.IEnumerable'(으)로 변환할 수 없습니다. [Assembly-CSharp-Editor]csharp(CS1503)
Turns out my Unity version was the issue :(
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 😔😔
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!
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.
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());
@@Inryhk Thank you! It works well
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 :(
You could try the latest on my GitHub, it’s evolved a bit further than this video but it should work with 2023 latest.
This tutorial is awesome.Can I share it on a Chinese website, Bilibili? I want to share this tutorial with more Chinese developers.
Yes absolutely!
@@TheKiwiCoder Thank you so much
Is it me, or did you create a State Machine?
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? ;-)
Hm I do not. I would suggest debugging they populate tree function to see what’s happening there.
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".
@@arthurjvnb Bless people like you! I couldnt figure out what was happening xD
@@lukasklingenberg1199 hahaha glad I could help you :D
Man! you have taken eras for putting this one in ;)
It’s been a busy Month!
@@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.
I now know how Anakin Skywalker felt. Sometimes, in order to achieve greatness, you've got to execute some children.
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 :(
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;
}
Oh and I called it compositor not composite just letting you know.
@@ArdaHamamcoglu thank you for giving an answer! :D
Hello, can I create some sort of curve editor using this?
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
I think you might want to check out custom property drawers. Good luck’
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
I'm also running into this issue. I'm using unity 2021.3.0f1
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.
@@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.
I really like your videos, but those keystroke sounds... Completly distract my focus. I guess you can use RTX Voice. Great content, thanks :)
Thanks for the feedback! I need better editing skills 😜
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.
It's a known bug. They are working on it. Meanwhile you can downgrade the UIBuilder version to get the functionality back
Can this manipulate scene objects?
unity has built in options to access selected, so maybe that is worth looking into?
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.
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...)
Awesome - finished it and can't wait for more - learned so much! Thanks!
I am NOT making a behavior tree but by god if this isnt the best (only?) quality tutorial on graph view.