Website powered by

How did I deal with… Checking out Active Interface in Pickup

The main point in any gameplay is how to let your nodes communicate with one another without using inefficient casting methods all the time. The solution I’m developing here consists of letting them use the same interface in each level, excluding the nodes not affected by it. I’m doing this by checking out whether the pickups are implementing the interface or not, leaving the ones with no active interface out of the loop. This is the method’s translation in the public section from header file of parent actor for pickup:

UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Interaction")
void OnInteract(AActor* Caller);
virtual void OnInteract_Implementation(AActor* Caller);

Read the original article here: https://www.3dartviz.com/skills/skills-tech/programming-video-game-interaction-cpp.html#activeInterface

This function checks out whether the pickup has an implemented interface, eliminating all actors from the loop that don't have one.

This function checks out whether the pickup has an implemented interface, eliminating all actors from the loop that don't have one.