Without having watch the video, you can find BeginPlay in the following cases.
BLUEPRINTS
You can find BeginPlay in any blueprint you create by right-clicking anywhere on the graph and typing in “Begin Play”. This will cause the contextual menu to display the “Begin Play” event node. Clicking on it will cause the node to appear in the graph, at which point you can pin it up to whatever methods you need to run.
It is recommended that you add a call to the parent function as well. To do this, right-click on the Begin Play event node and select “Add call to parent function”. If it is grayed out and unselectable you do not need to worry about it.
When the uploader said “Find the BeginPlay in the character class”, it means finding this node. If you type “Begin Play” in the context menu and click on the result, if the event node already exists it will take you to that node.
C++
To create the BeginPlay method in a C++ class you would add the following code.
In your character’s header file add the following line:
virtual void BeginPlay() override;
“Virtual” indicates that the method can be overridden in child classes. “void” is the return type - void meaning the method does not return anything. “override” indicates that it is “replacing” the method call of a parent method which uses the aforementioned “virtual” keyword.
In your character’s cpp file add the following code:
void AMyCharacterClass::BeginPlay()
{
Super::BeginPlay();
}
“void” once again indicates that the method does not return anything. This needs to match the return type specified in the header. “AMyCharacterClass::” indicates that the method belongs to the specified class. “BeginPlay()” is the name of the method.
The “Super::BeginPlay()” line indicates that we want to call the parent’s version of this method. If you recall we specified in the header that we are “replacing” the parent’s method call. It is not specifically that it is replaced, but it is being called instead of the other method. Here we are making a call to the other method to ensure it executes. We can then add custom functionality afterwards.
void AMyCharacterClass::BeginPlay()
{
Super::BeginPlay();
DoCustomEvents();
CauseSuperMassiveExplosion();
}
When the uploader said “Find the BeginPlay in the character class”, it means finding the implementation of this code.