- Hands-On Artificial Intelligence with Unreal Engine
- Francesco Sapio
- 274字
- 2021-06-24 15:23:26
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.
- The Complete Rust Programming Reference Guide
- Bootstrap Site Blueprints Volume II
- Java Web基礎(chǔ)與實(shí)例教程(第2版·微課版)
- Arduino開(kāi)發(fā)實(shí)戰(zhàn)指南:LabVIEW卷
- Lua程序設(shè)計(jì)(第4版)
- Mastering Ext JS
- Unity 5 for Android Essentials
- Learning Python Design Patterns
- 從零開(kāi)始學(xué)Selenium自動(dòng)化測(cè)試:基于Python:視頻教學(xué)版
- Python編程入門(mén)(第3版)
- iOS Development with Xamarin Cookbook
- 從零開(kāi)始學(xué)UI設(shè)計(jì)·基礎(chǔ)篇
- 輕松學(xué)Scratch 3.0 少兒編程(全彩)
- Azure for Architects
- Practical Linux Security Cookbook