官术网_书友最值得收藏!

AI Controller in Blueprint

We can create a Blueprint AI Controller by clicking on Add New | Blueprint Class | AI Controller. You will have to click All Classes and search for AI Controller to access it. You can see an example of this in the following screenshot:

For now, we will call our AI Controller BP_MyFirstAIController. Double-click on it to open the Blueprint Editor.

First, we need to create a variable so that we can store our Behavior Tree. Although it's not necessary to keep reference of the Behavior Tree, it's good practice to do so. To create a variable, we need to press the + Variable button in the My Blueprint panel, next to the Variables tab, as shown in the following screenshot (keep in mind that your cursor needs to be on the Variables tab for the button to show up):

Then, as a variable type, you need to select Behavior Tree and give it a name, such as BehaviorTreeReference. This is how what your variable should look like:

Then, in the Detail Panel, we will set the Default value (remember that to set the default value, the Blueprint needs to be compiled):

Then, we need to override the On Possess function, as shown in the following screenshot:

Finally, in the Event On Possess of the AI Controller, we need to start running/executing the Behavior Tree. We can achieve this by using the following simple node, named Run Behavior Tree:

As a result, your AI controller will be able to execute the Behavior Tree that's stored within the BehaviorTreeReference.

主站蜘蛛池模板: 英超| 阿瓦提县| 卓尼县| 江油市| 海宁市| 靖远县| 三门县| 四川省| 怀仁县| 阿城市| 新兴县| 清新县| 长寿区| 苗栗市| 寿光市| 赤水市| 八宿县| 平罗县| 铜川市| 巫溪县| 汨罗市| 林芝县| 崇左市| 新邵县| 延吉市| 龙口市| 土默特右旗| 赤峰市| 迁西县| 碌曲县| 连城县| 贵南县| 随州市| 浪卡子县| 浠水县| 文成县| 垣曲县| 邵阳县| 东乡族自治县| 田东县| 明星|