UE4 – Blueprints – Set Parent Class

Software:
Unreal Engine 4.24

When It comes to OOP inheritance, the best practice is to take a moment to think about code structure and decide which classes should be be extensions of a common super-class. But in a wild hackathon or game-jam, we may be blueprinting too hastily for that, and we may find out different blueprint classes actually have to be child classes of a common parent class after they already exist and have existing blueprints in them.
In this case will have to Set their parent class as a different class than the class we chose when we initially created them, and also create calls to the parent class event functions if needed.

Setting a BP’s parent class:

Click Class Settings, and under Class Options, in the Parent Class drop-down select the wanted parent class (superclass).
Annotation 2020-03-22 131138

 

Calling the Parent Class’s event functions:

Note:
When creating a BP class that is defined as child class in its creation this is done automatically

  1. Right-Click the current class’s Event icon, and select Add call to parent function:Annotation 2020-03-22 153156
  2. Connect the execution flow graph, and other inputs if necessary:
    Annotation 2020-03-22 161019

 

 

UE4 Blueprints – Spawn Actor Transform Note..

Software:
Unreal Engine 4.24

Short version:
When Spawning new actors via the SpanActor Blueprint node, initial transform must be supplied to the SpanActor node, and not defined in the spawned Actor Class’s Blueprint.

Annotation 2020-03-22 131138

Explanation:
Just found out the hard way, that when you spawn an Actor using the SpawnActor blueprint node, the transform data connected to the SpawnActor node is actually applied after the actors Construction Script and BeginPlay Event.
This means any transform you will try to apply in the spawned Actor’s Blueprint will be overridden and therefore not work.

UE4 – First Person Projectile Overlap Event

Software:
Unreal Engine 4.24

Had some frustrating time not understanding why doesn’t the FirstPersonProjectile Actor doesn’t “play ball” and generate Overlap Events when hitting my bad guys..
It turns out I had to change its collision (sphere) component’s collision settings to overlap dynamic objects (see image):
Annotation 2020-03-14 231242

UE4 Blueprint Delay node

Software:
Unreal Engine 4.18

Untitled-1

The Delay node serves as a timer that will execute the connected blueprint after a predefined time in seconds.

An example of usage could be triggering a game event at a set time after the player entered a location.
You can use random values or other expressions connected to the Duration input to create a richer and less predictable interaction.

UE4 – Enable input for a Blueprint

Software:
Unreal Engine 4.18

By default, Blueprint Actors are set not to receive player input.
* If every Blueprint would be listening to player input events it would hurt game performance.

To enable input events for a Blueprint:
In the Blueprint’s Event Graph,
Connect an Enable Input node to the BeginPlay Event,
Create a Get Player Controller node and connect it to the Player Controller parameter of the Enable Input node to set which player input events to listen to.

Untitled-1.jpg

UE4 Actor Blueprint – Referencing another Actor instance

Software:
Unreal Engine 4.18

A direct reference to another actor instance can’t be created from within the blueprint because it can only be provided at run-time after the instances have been created, both the current actor and the other actor we want to refer to.

In the Actor Blueprint:

  1. Add a new variable of type Actor > Object Reference
  2. Make the variable public and editable in the editor (the eye button..)
  3. Hit Compile and Save.

In the Map Editor:

  1. Place both actors in the map and save it.
  2. Select the actor in which you created the reference variable.
  3. In the Details panel, set the Actor property you created to the wanted other Actor instance.

Untitled-7.jpg

Untitled-7.jpg