Self Reinforcement for pointers and object names

In order to call an object name, you will need a reference that pulls that name.

the function GetOwner(), which is a method of AActor, has a method GetName() which needs to be used to grab the actual name of the Actor Object in question.

In order to call it within a log is by first setting up an FString variable to hold the name of the object.

FString ObjectName = GetOwner()->GetName(); // Gets the name of the object this component is connected to, and defines the Variable ObjectName as such.

Then, the next step is to check if the name is being used correctly. A Log function is needed.

UE_LOG() is used in order to print outputs.

UE_LOG(LogTemp, Type, TEXT(“Your Text Here”),*StringVariables ) // This will print out a message to the output log if you give it an appropriate type.

%s, will just call the string variable defined in the UE_LOG statement.

So in order for it to print out an object name appropriately:

UE_LOG(LogTemp, Warning, TEXT(“Warning! %s”), *ObjectName);

Nice summary. This is a tricky lecture so it’s nice to see it in other words. Thanks

Privacy & Terms