Don't understand part of this tutorial

Hey guys. I’m trying to follow this free tutorial on youtube. Its about basic of AI. It works fine without any problem but I can not understand part of it.

My first question:
In UE4 this dude added a “BlackboardData” and added two keys inside it. “Enemy” and “Destination”.
In C++ this dude use that “BlackboardData” with this code:



BlackboardComp = PCIP.CreateDefaultSubobject<UBlackboardComponent>(this, TEXT("BlackBoardComp"));


How above code links BlackboardComp with “BlackboardData”? I mean if I have several “BlackboardData” how above code understand to link to correct one?

My second question is:
This dude wrote a function “Possess”, but he never called it! Then how this function works?!

My last question is:
In Tutorial_bot.cpp this dude wrote this code:



AIControllerClass = ATutorial_Controller::StaticClass();


Why he wrote this? Why inside Tutorial_bot.cpp?

Thank you for help.

First I didn’t watched the video :slight_smile:

creates a new blackbord component with the name BlackBoardComp and this component is assigned to the BlackboardComp variable

the function possess is automatically called from the engine after your playercontroller is set up and your pawn/character is created. You can manually call it but that depends on what you want to archive.

AIControllerClass is a variable from the parent class that defines what class should be created if we want it to be controlled by an AI.
ATutorial_Controller::StaticClass() is just your custom AIController class

hm…
Much appreciated :slight_smile:

It is easier if you download the whole source code from github rather than having only the header files as external dependencies . You can then see where this function is used and what it does.
There are some useful comments inside the code too :slight_smile: