Unreal Dev Hints & Tips

Animation - Noticing your characters overlaps or hits from their collision boxes aren't as reliable on a client when networked?

on Dec 27, 2021

The solution:

If the collision primitive is attached to the character e.g. a collision box attached to a fist, and the collision overlaps fire unreliably when moving with a player animation.

The animation might be getting culled or partially played (no bone updates) when the client isn't in the servers view.
Try setting Optimisation > Visibility based anim tick option > Always tick pose and refresh bones on the character skeletal mesh (in BP) or
In C++ GetMesh()->VisibilityBasedAnimTickOption = EVisibilityBasedAnimTickOption::AlwaysTickPoseAndRefreshBones; on the skeletal mesh for the character.

Physics - Is your physics volume not reacting to your actor?

on Dec 27, 2021

The solution:

Make sure you set "SetShouldUpdatePhysicsVolume(true)" in code or in the BP to ensure the actor updates the physics volume.

Networking - Having trouble getting a packaged game to connect over the net?

on Dec 27, 2021

Ports all forwarded but it just doesn't seem to listen on the port?

The solution:

Make sure you have "Networking" and "Sockets" set in your Project.Build.cs file.
PublicDependencyModuleNames.AddRange(new string[] { "GameplayAbilities", "GameplayTags", "GameplayTasks", "Core", "CoreUObject", "Engine", "InputCore", "UMG", "ApexDestruction", "PhysicsCore", "Networking", "Sockets", "Http"});

Gameplay Ability System - Gameplay Cue doesn't end after the ability ends

on Dec 27, 2021

The solution:

Remember to set AutoDestroyOnRemove in the cleanup section of the cue BP!!

Loading Files - You need a way to load a specific Blueprint of any class directly from a file path in C++

on Dec 27, 2021

The solution:

static ConstructorHelpers::FObjectFinder ObjectBP(TEXT("WidgetBlueprint'/Game/Blueprints/HUD/BP_IGC_TimerBarWidget.BP_IGC_TimerBarWidget_C'"));
if (ObjectBP.Object != NULL)
{
// Set the object as the blueprint at the reference above.
SetWidget(ObjectBP.Object);
}

A few important notes!!
This function should only be used in your classes constructor! Anywhere else causes a crash!
It may seem that you should set the type to the object type e.g. but use UClass instead.
The _C in the file path is a specific required tag that is appended to the actual file path only in code.
To be clear the actual file path is: (WidgetBlueprint'/Game/Blueprints/HUD/BP_IGC_TimerBarWidget.BP_IGC_TimerBarWidget'').
If you want the actual object you need to call .Object.

When to use it, This is usually best to use when:The file name or location won't change, if the file can't be found, issues ahoy!
The object needs to be set during the construction of the object for example, you have a UWidgetComponent that needs to have a UUserWidget class set from a BP but it needs to be set as soon as the WidgetComponent is created.

Hope you guys find this useful!

Physics - Your object BP won't start with the SetSimulatePhysics set to true when you set it in code

on Dec 27, 2021

The solution:

You need to make sure you set it on the body instance and not at the actor level:Object->GetBodyInstance(NAME_None, false)->SetInstanceSimulatePhysics(true)

I've personally used this on a UDestructibleComponent