4.8 Transition Guide

AmbientOcclusionDistance postprocess setting has be removed

/** >0, in unreal units, how wide the ambient occlusion effect should affect the geometry (in depth), will be removed - only used for non normal method which is not exposed */
UPROPERTY()
float AmbientOcclusionDistance_DEPRECATED;

Just Append “_DEPRECATED” to AmbientOcclusionDistance for now to handle the migration later.

You can’t override [FONT=Courier New]Tick() from [FONT=Courier New]UActorComponent because it’s marked [FONT=Courier New]final, so I’m not entirely sure how to deal with the loss of [FONT=Courier New]ReceiveTick() in my custom components. Any thoughts?

Updated World API

OverlapTest(Pos, Rot, CollisionShape, Params, ObjectQueryParams)
…BECOMES…
OverlapAnyTestByObjectType(Pos, Rot, ObjectQueryParams, CollisionShape, Params);

LineTraceSingle(OutHit, Start, End, TraceChannel, Params, ResponseParam )
…BECOMES…
LineTraceSingleByChannel(OutHit, Start, End, TraceChannel, Params, ResponseParam);

SweepSingle(OutHit, Start, End, Rot, TraceChannel, CollisionShape, Params, ResponseParam);
…BECOMES…
SweepSingleByChannel(OutHit, Start, End, Rot, TraceChannel, CollisionShape, Params, ResponseParam);

ect…

UWidget::GatherAllChildren, function removed
UWidget::GatherChildren, function removed

“Removing some old functions from UWidget for gathering children widgets that didn’t perform all the correct logic. You should use the WidgetTree’s functions for traversing the tree.”

UWidget::GatherChildren(AsUserWidget->GetRootWidget(), Children);
…BECOMES…
UWidgetTree::GetChildWidgets(AsUserWidget->GetRootWidget(), Children);

Also, need to use TArray and not TSet now. =)

Yes looking at ShooterGame 4.8 ReceiveActorEndOverlap has now been replaced with

virtual void NotifyActorBeginOverlap(class AActor* Other) override;

Use TickComponent

Thanks Mark. That’s what I did, but wasn’t sure it was right.

Another one - Blackboard Key filters:



	BlackboardKey.AddVectorFilter(this);
	BlackboardKey.AddObjectFilter(this, AActor::StaticClass());


Will give a deprecation warning (not error). Fixed like so:



	BlackboardKey.AddVectorFilter(this, GET_MEMBER_NAME_CHECKED(UBTTask_SetFocalPointToBBEntry, BlackboardKey));
	BlackboardKey.AddObjectFilter(this, GET_MEMBER_NAME_CHECKED(UBTTask_SetFocalPointToBBEntry, BlackboardKey), AActor::StaticClass());


//PhysX changes

“physx::PxRigidDynamic* Actor”
Has been removed from, struct FDestructibleChunkInfo.

If you need to access the PxRigidDynamic Actors a thread safe way is:



	FPhysScene* PhysScene = GetWorld()->GetPhysicsScene();
	const uint32 SceneType = BodyInstance.UseAsyncScene(PhysScene) ? PST_Async : PST_Sync;
	PxScene* PScene = PhysScene->GetPhysXScene(SceneType);

	SCOPED_SCENE_WRITE_LOCK(PScene);
	{
		uint32 ChunkCount = ApexDestructibleActor->getNumVisibleChunks();
		const uint16* ChunkIndices = ApexDestructibleActor->getVisibleChunks();
		for (uint32 c = 0; c < ChunkCount; c++)
		{
			PxRigidDynamic* Actor = ApexDestructibleActor->getChunkPhysXActor(ChunkIndices[c]);
			check(Actor);
                        Actor->dostuff...
                 }
          }


OK I just tried to upgrade my project from 4.7.6 to 4.8.0 and it’s not working. Getting between 21 to 103 errors in visual studio.

Before I upgraded, I made sure that everything was working in 4.7.6. Also I made sure to make a backup of my project.

So from there, I right clicked on the *.uproject file and clicked on Switch Unreal Engine Version. I changed it to 4.8. No problems, didn’t get any errors. I loaded my .sln file and there the problems began.

  • I have 2 classes that are telling me Error: cannot open source file "(class name).generated.h"
  • I made sure, as per previous posts that I has $(LibraryPath); in my include paths.
  • As per some, I even tried to run Visual Studio as Administrator. Still not working.

Here’s the main errors that I am getting (I tried with win64 and Android):


Error	1	error code: OtherCompilationError (5)	C:\Users\Marc-Andre\Google Drive\Hangar 74\UE4\BengalTiger\Intermediate\ProjectFiles\Error	BengalTiger
Error	2	error MSB3075: The command ""C:\Program Files\Epic Games\4.8\Engine\Build\BatchFiles\Rebuild.bat" BengalTiger Android Development 
"C:\Users\Marc-Andre\Google Drive\Hangar 74\UE4\BengalTiger\BengalTiger.uproject" -rocket" exited with code 5. Please verify that you have sufficient rights to run this command.	C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets	43	5	BengalTiger


The rest are errors from IntelliSense.

I deleted the Intermediate folder and the ,sdf file and then regenerated the project files. Compiled my project and…

I no longer get the IntelliSense errors but I do get these errors which are similar to the previous ones but not exactly!


Error	1	error code: OtherCompilationError (5)	C:\Users\Marc-Andre\Google Drive\Hangar 74\UE4\BengalTiger\Intermediate\ProjectFiles\Error	BengalTiger
Error	2	error MSB3075: The command ""C:\Program Files\Epic Games\4.8\Engine\Build\BatchFiles\Rebuild.bat" BengalTigerEditor Win64 Development 
"C:\Users\Marc-Andre\Google Drive\Hangar 74\UE4\BengalTiger\BengalTiger.uproject" -rocket" exited with code 5. Please verify that you have sufficient rights to run this command.	C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets	43	5	BengalTiger

If I start a new C++ project, I don’t get these errors. So there seems to be something not upgrading properly when changing engine version.

What am I missing?

thanks.

struct FSceneViewProjectionData Changes…

FMatrix ViewMatrix;
…BECOMES…
FMatrix ViewRotationMatrix;

and with that, was my final fix to get my project on 4.8… yay!

After my backup, I always delete my binaries and intermediate folders. Then I switch engine version from the uproject. Finally, I “Generate Visual Studio Project Files” from the uproject file.

It seems to be the cleanest for me.

thanks for the suggestion but still same problem…

Ok, i manage to compile and open the editor. Now i cant open any blueprint (and when i mean ANY, is even a new blueprint subclass inheriting from actor for example). When i attempt to open one:


Unknown exception - code 00000001 (first/second chance not available)

"Assertion failed: (Index >= 0) & (Index < ArrayNum) [File:D:\BuildFarm\buildmachine_++depot+UE4-Releases+4.8\Engine\Source\Runtime\Core\Public\Containers\Array.h] [Line: 678] 
Ar

KERNELBASE
UE4Editor_Core!FOutputDeviceWindowsError::Serialize() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\core\private\windows\windowsplatformoutputdevices.cpp:95]
UE4Editor_Core!FOutputDevice::Logf__VA() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\core\private\misc\outputdevice.cpp:144]
UE4Editor_Core!FDebug::AssertFailed() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\core\private\misc\outputdevice.cpp:355]
UE4Editor_BlueprintGraph!UK2Node::ExpandSplitPin() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\editor\blueprintgraph\private\k2node.cpp:687]
UE4Editor_BlueprintGraph!UK2Node::ExpandNode() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\editor\blueprintgraph\private\k2node.cpp:712]
UE4Editor_BlueprintGraph!UK2Node_VariableGet::ExpandNode() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\editor\blueprintgraph\private\k2node_variableget.cpp:386]
UE4Editor_KismetCompiler!FKismetCompilerContext::ExpansionStep() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\editor\kismetcompiler\private\kismetcompiler.cpp:2535]
UE4Editor_KismetCompiler!FKismetCompilerContext::ProcessOneFunctionGraph() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\editor\kismetcompiler\private\kismetcompiler.cpp:3043]
UE4Editor_KismetCompiler!FKismetCompilerContext::CreateFunctionList() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\editor\kismetcompiler\private\kismetcompiler.cpp:3132]
UE4Editor_KismetCompiler!FKismetCompilerContext::Compile() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\editor\kismetcompiler\private\kismetcompiler.cpp:3371]
UE4Editor_KismetCompiler!FKismet2CompilerModule::CompileBlueprintInner() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\editor\kismetcompiler\private\kismetcompilermodule.cpp:99]
UE4Editor_KismetCompiler!FKismet2CompilerModule::CompileBlueprint() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\editor\kismetcompiler\private\kismetcompilermodule.cpp:155]
UE4Editor_UnrealEd!FKismetEditorUtilities::GenerateBlueprintSkeleton() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\editor\unrealed\private\kismet2\kismet2.cpp:893]
UE4Editor_UnrealEd!FBlueprintEditorUtils::RegenerateBlueprintClass() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\editor\unrealed\private\kismet2\blueprinteditorutils.cpp:1412]
UE4Editor_CoreUObject!FLinkerLoad::RegenerateBlueprintClass() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\coreuobject\private\blueprint\blueprintsupport.cpp:332]
UE4Editor_CoreUObject!FLinkerLoad::FinalizeBlueprint() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\coreuobject\private\blueprint\blueprintsupport.cpp:1140]
UE4Editor_CoreUObject!FLinkerLoad::Preload() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\coreuobject\private\uobject\linkerload.cpp:3098]
UE4Editor_CoreUObject!FLinkerLoad::CreateExport() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\coreuobject\private\uobject\linkerload.cpp:3698]
UE4Editor_CoreUObject!FLinkerLoad::IndexToObject() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\coreuobject\private\uobject\linkerload.cpp:3882]
UE4Editor_CoreUObject!FLinkerLoad::CreateExport() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\coreuobject\private\uobject\linkerload.cpp:3413]
UE4Editor_CoreUObject!FLinkerLoad::IndexToObject() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\coreuobject\private\uobject\linkerload.cpp:3882]
UE4Editor_CoreUObject!FLinkerLoad::CreateExport() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\coreuobject\private\uobject\linkerload.cpp:3413]
UE4Editor_CoreUObject!FLinkerLoad::IndexToObject() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\coreuobject\private\uobject\linkerload.cpp:3882]
UE4Editor_CoreUObject!FLinkerLoad::CreateExport() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\coreuobject\private\uobject\linkerload.cpp:3413]
UE4Editor_CoreUObject!FLinkerLoad::CreateExportAndPreload() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\coreuobject\private\uobject\linkerload.cpp:2581]
UE4Editor_CoreUObject!FLinkerLoad::LoadAllObjects() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\coreuobject\private\uobject\linkerload.cpp:2689]
UE4Editor_CoreUObject!LoadPackageInternal() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:997]
UE4Editor_CoreUObject!ResolveName() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:677]
UE4Editor_CoreUObject!StaticLoadObjectInternal() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:764]
UE4Editor_CoreUObject!StaticLoadObject() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:826]
UE4Editor_Kismet!FBlueprintEditor::LoadLibrariesFromAssetRegistry() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\editor\kismet\private\blueprinteditor.cpp:1512]
UE4Editor_Kismet!FBlueprintEditor::CommonInitialization() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\editor\kismet\private\blueprinteditor.cpp:1434]
UE4Editor_Kismet!FBlueprintEditor::InitBlueprintEditor() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\editor\kismet\private\blueprinteditor.cpp:1580]
UE4Editor_Kismet!FBlueprintEditorModule::CreateBlueprintEditor() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\editor\kismet\private\blueprinteditormodule.cpp:152]
UE4Editor_AssetTools!FAssetTypeActions_Blueprint::OpenAssetEditor() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\developer\assettools\private\assettypeactions\assettypeactions_blueprint.cpp:78]
UE4Editor_UnrealEd!FAssetEditorManager::OpenEditorForAsset() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\editor\unrealed\private	oolkits\asseteditormanager.cpp:303]
UE4Editor_AssetTools!FAssetTypeActions_Base::AssetsActivated() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\developer\assettools\public\assettypeactions_base.h:37]
UE4Editor_ContentBrowser!SContentBrowser::OnAssetsActivated() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\editor\contentbrowser\private\scontentbrowser.cpp:1603]
UE4Editor_ContentBrowser!TBaseSPMethodDelegateInstance<0,SContentBrowser,0,TTypeWrapper<void> __cdecl(TArray<FAssetData,FDefaultAllocator> const & __ptr64,enum EAssetTypeActivationMethod::Type)>::Execute() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\core\public\delegates\delegateinstancesimpl_variadics.inl:282]
UE4Editor_ContentBrowser!TBaseSPMethodDelegateInstance<0,SContentBrowser,0,void __cdecl(TArray<FAssetData,FDefaultAllocator> const & __ptr64,enum EAssetTypeActivationMethod::Type)>::ExecuteIfSafe() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\core\public\delegates\delegateinstancesimpl_variadics.inl:388]
UE4Editor_ContentBrowser!SAssetView::OnListMouseButtonDoubleClick() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\editor\contentbrowser\private\sassetview.cpp:3222]
UE4Editor_ContentBrowser!TBaseSPMethodDelegateInstance<0,SAssetView,0,TTypeWrapper<void> __cdecl(TSharedPtr<FAssetViewItem,0>)>::Execute() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\core\public\delegates\delegateinstancesimpl_variadics.inl:282]
UE4Editor_ContentBrowser!TBaseSPMethodDelegateInstance<0,SAssetView,0,void __cdecl(TSharedPtr<FAssetViewItem,0>)>::ExecuteIfSafe() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\core\public\delegates\delegateinstancesimpl_variadics.inl:388]
UE4Editor_ContentBrowser!TBaseDelegate<void,TSharedPtr<FAssetViewItem,0> >::ExecuteIfBound() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\core\public\delegates\delegatesignatureimpl_variadics.inl:519]
UE4Editor_ContentBrowser!SListView<TSharedPtr<FAssetViewItem,0> >::Private_OnItemDoubleClicked() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\slate\public\widgets\views\slistview.h:689]
UE4Editor_ContentBrowser!STableRow<TSharedPtr<FAssetViewItem,0> >::OnMouseButtonDoubleClick() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\slate\public\widgets\views\stablerow.h:252]
UE4Editor_Slate!<lambda_58ede244782f1e594383d45514e1d7c8>::operator()() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\slate\private\framework\application\slateapplication.cpp:4101]
UE4Editor_Slate!FEventRouter::Route<FReply,FEventRouter::FBubblePolicy,FPointerEvent,<lambda_58ede244782f1e594383d45514e1d7c8> >() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\slate\private\framework\application\slateapplication.cpp:212]
UE4Editor_Slate!FSlateApplication::ProcessMouseButtonDoubleClickEvent() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\slate\private\framework\application\slateapplication.cpp:4102]
UE4Editor_Slate!FSlateApplication::OnMouseDoubleClick() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\slate\private\framework\application\slateapplication.cpp:4082]
UE4Editor_Core!FWindowsApplication::ProcessDeferredMessage() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\core\private\windows\windowsapplication.cpp:1348]
UE4Editor_Core!FWindowsApplication::DeferMessage() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\core\private\windows\windowsapplication.cpp:1711]
UE4Editor_Core!FWindowsApplication::ProcessMessage() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\core\private\windows\windowsapplication.cpp:706]
UE4Editor_Core!FWindowsApplication::AppWndProc() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\core\private\windows\windowsapplication.cpp:628]
user32
user32
UE4Editor_Core!FWindowsPlatformMisc::PumpMessages() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\core\private\windows\windowsplatformmisc.cpp:792]
UE4Editor!FEngineLoop::Tick() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\launch\private\launchengineloop.cpp:2319]
UE4Editor!GuardedMain() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\launch\private\launch.cpp:142]
UE4Editor!GuardedMainWrapper() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\launch\private\windows\launchwindows.cpp:126]
UE4Editor!WinMain() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\launch\private\windows\launchwindows.cpp:200]

I am frustrated trying to solve this.
On the other hand the error message dontnt help me too much (I’m not really an expert cpp developer)

hope someone can help.
I opened a bug ticket:

Ah the good old Serialize() error. I think 90% of my crashes come from there. As of 4.8 I get weird endless loops that calls my character constructor over and over and it’s also related to serialize. It only happens when I try to spawn my player and bot characters using my specific game mode. However I didn’t have any luck finding the error because the Crash Reporter conveniently omits the lines that are related to my code.

Dear Everyone,

Thanks for sharing your research everyone!

Wild! Thanks for sharing your many findings Devero!

:slight_smile:

Rama

UObject Sub System Multi Threading, Constructor/Serialize Thread Safety

Epic is making the UObject subsystem work with multi threading, and that means constructors have to operate in a multi threaded environment, and that means that all C++ UObject constructors need to be thread safe!

So every time you look at your code in your C++ constructors now, think to yourself “is this thread safe?”

Big description of this toward the end of the release notes:

Here’s a nice big quote you can do a search for to see the pretty and very helpful pictures that Epic posted:

Quote From Epic

"
We’re planning to enable async loading thread by default in future releases so it’s a good time to start looking through gameplay C++ code to make sure that all UObject-derived class constructors, as well as all overrides of UObject::Serialize and UObject::PostInitProperties functions are thread-safe.

The most common pitfall is accessing global managers (singletons) from those functions without guaranteeing thread safety of the operations performed on them.
"

Good luck!

Rama

How to Override MoveComponent() in 4.8

Dear Community,

As of 4.8, you cannto override USceneComponent::MoveComponent anymore, instead you should override MoveComponentImpl

USceneComponent.h




**//Quat used now for speed**
bool MoveComponent( const FVector& Delta, const FQuat& NewRotation,    bool bSweep, FHitResult* Hit=NULL, EMoveComponentFlags MoveFlags = MOVECOMP_NoFlags );

//not virtual anymore
bool MoveComponent( const FVector& Delta, const FRotator& NewRotation, bool bSweep, FHitResult* Hit=NULL, EMoveComponentFlags MoveFlags = MOVECOMP_NoFlags );

protected:

**// Override this method for custom behavior.**
virtual bool **MoveComponentImpl**( const FVector& Delta, const FQuat& NewRotation, bool bSweep, FHitResult* Hit=NULL, EMoveComponentFlags MoveFlags = MOVECOMP_NoFlags );


:slight_smile:

Rama

OverlapSingle -> OverlapMultiByChannel

Dear Community,

OverlapSingle is deprecated and we must now decide which overlap to use from OverlapMultiByChannel

Here’s an example of how I chose to transition one of my static library functions that performs a Sphere overlap test

Old Code



static FORCEINLINE bool SphereOverlapTest(
	UWorld* World, 
	AActor* ActorToIgnore,
	const FBox& Box,
	FOverlapResult& HitOut,
	ECollisionChannel TraceChannel,
	FQuat Rotation = FQuat::Identity
){
	FCollisionQueryParams TraceParams(FName(TEXT("VictoreCore Trace")), true, ActorToIgnore);
	TraceParams.bTraceComplex = true;
 
	//Ignore Actors
	TraceParams.AddIgnoredActor(ActorToIgnore);
	
	//Re-initialize hit info
	HitOut = FOverlapResult();
	  
	return World->**OverlapSingle**(
		HitOut, 
		Box.GetCenter(), 
		Rotation, 
		TraceChannel, 		//! <~~~~
		FCollisionShape::MakeBox(Box.GetExtent()), 
		TraceParams
	);
}


4.8 Code

Notice I am choosing to always use the first overlap.

Please see comment by Epic Ori Cohen regarding this matter.

My current implementation is really only good for knowing if any overlaps occur at all, as the first overlap is not necessarily the closest, as per Ori’s comment above.



//New Code, Implementation is to always use the first overlap from the array.
static FORCEINLINE bool SphereOverlapTest(
	UWorld* World, 
	AActor* ActorToIgnore,
	const FBox& Box,
	FOverlapResult& HitOut,
	ECollisionChannel TraceChannel,
	FQuat Rotation = FQuat::Identity
){
	FCollisionQueryParams TraceParams(FName(TEXT("VictoreCore Trace")), true, ActorToIgnore);
	TraceParams.bTraceComplex = true;
 
	//Ignore Actors
	TraceParams.AddIgnoredActor(ActorToIgnore);
	
	//Re-initialize hit info
	HitOut = FOverlapResult();
	 
	TArray<FOverlapResult> Overlaps;
	bool bAnyOverlaps = World->**OverlapMultiByChannel**(
		Overlaps,
		Box.GetCenter(), 
		Rotation, 
		TraceChannel, 		//! <~~~~
		FCollisionShape::MakeBox(Box.GetExtent()), 
		TraceParams
	);
	if (!bAnyOverlaps || Overlaps.Num() < 1) //extra array access safety check
        {
            return false;
	}

	//Always use first overlap!
	HitOut = Overlaps[0];
	 
	return true;
}


Enjoy!

:slight_smile:

Rama

We had the same problem. GitHub looks down from here, so I can’t copy the code directly, but we had to call the version of NewObject which takes an FName, otherwise the game would crash and cry about the component not having an owner.

EDIT: Just read that you don’t actually call it directly yourself. I’ll leave this post up for other users that do use it directly like we did.