x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

[Crash][4.7.1] When calling USphereComponent::GetOverlappingActors instance method

When doing the tutorial "Introduction to UE4 Programming - 5 - Empowering the Character", the editor started crashing every time when executing the pickup input action, which callbacks CollectBatteries method. The crash reportert says the problem is on the following line:

TArray collectedActors;

CollectionSphere->GetOverlappingActors(collectedActors); // <-- here

This is the declaration of the CollectionSphere variable:

UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Power, meta = (AllowPrivateAccess = "true"))

class USphereComponent *CollectionSphere;

and this is the initialization code:

CollectionSphere = CreateDefaultSubobject(TEXT("CollectionSphere"));

CollectionSphere->AttachTo(RootComponent);

CollectionSphere->SetSphereRadius(200.0f);

This is the action binding code:

InputComponent->BindAction("Pickup", IE_Pressed, this, &ACodeTutorialCharacter::CollectBatteries);

When the environment crashes, this is the crash report i get:

MachineId:903DE8F84C61EBD7E3B967B9E70D382A

Access violation - code c0000005 (first/second chance not available)

Ensure condition failed: false [File:D:\Programs\UnrealEngine-4.7.1\Engine\Source\Runtime\Engine\Private\SceneComponent.cpp] [Line: 914] Template Mismatch during attachment. Attaching instanced component to template component. Parent 'CollisionC

UE4Editor_Engine!UPrimitiveComponent::GetOverlappingActors() + 79 bytes [d:\programs\unrealengine-4.7.1\engine\source\runtime\engine\private\primitivecomponent.cpp:2089] UE4Editor_CodeTutorial!ACodeTutorialCharacter::CollectBatteries() + 85 bytes [d:\projects\unreal projects\codetutorial\source\codetutorial\codetutorialcharacter.cpp:154] UE4Editor_Engine!UPlayerInput::ProcessInputStack() + 8096 bytes [d:\programs\unrealengine-4.7.1\engine\source\runtime\engine\private\userinterface\playerinput.cpp:1064] UE4Editor_Engine!APlayerController::ProcessPlayerInput() + 94 bytes [d:\programs\unrealengine-4.7.1\engine\source\runtime\engine\private\playercontroller.cpp:2367] UE4Editor_Engine!APlayerController::TickPlayerInput() + 1393 bytes [d:\programs\unrealengine-4.7.1\engine\source\runtime\engine\private\playercontroller.cpp:3728] UE4Editor_Engine!APlayerController::PlayerTick() + 75 bytes [d:\programs\unrealengine-4.7.1\engine\source\runtime\engine\private\playercontroller.cpp:2045] UE4Editor_Engine!APlayerController::TickActor() + 702 bytes [d:\programs\unrealengine-4.7.1\engine\source\runtime\engine\private\playercontroller.cpp:3801] UE4Editor_Engine!FActorTickFunction::ExecuteTick() + 580 bytes [d:\programs\unrealengine-4.7.1\engine\source\runtime\engine\private\actor.cpp:119] UE4Editor_Engine!FTickTaskSequencer::FTickFunctionTask::DoTask() + 214 bytes [d:\programs\unrealengine-4.7.1\engine\source\runtime\engine\private\ticktaskmanager.cpp:322] UE4Editor_Engine!TGraphTask::ExecuteTask() + 445 bytes [d:\programs\unrealengine-4.7.1\engine\source\runtime\core\public\async\taskgraphinterfaces.h:671] UE4Editor_Core!FTaskThread::ProcessTasks() + 3109 bytes [d:\programs\unrealengine-4.7.1\engine\source\runtime\core\private\async\taskgraph.cpp:428] UE4Editor_Core!FTaskThread::ProcessTasksUntilQuit() + 77 bytes [d:\programs\unrealengine-4.7.1\engine\source\runtime\core\private\async\taskgraph.cpp:271] UE4Editor_Core!FTaskGraphImplementation::WaitUntilTasksComplete() + 511 bytes [d:\programs\unrealengine-4.7.1\engine\source\runtime\core\private\async\taskgraph.cpp:984] UE4Editor_Engine!FTaskGraphInterface::WaitUntilTaskCompletes() + 367 bytes [d:\programs\unrealengine-4.7.1\engine\source\runtime\core\public\async\taskgraphinterfaces.h:188] UE4Editor_Engine!FTickTaskSequencer::ReleaseTickGroup() + 432 bytes [d:\programs\unrealengine-4.7.1\engine\source\runtime\engine\private\ticktaskmanager.cpp:187] UE4Editor_Engine!FTickTaskManager::RunTickGroup() + 1182 bytes [d:\programs\unrealengine-4.7.1\engine\source\runtime\engine\private\ticktaskmanager.cpp:722] UE4Editor_Engine!UWorld::RunTickGroup() + 102 bytes [d:\programs\unrealengine-4.7.1\engine\source\runtime\engine\private\leveltick.cpp:696] UE4Editor_Engine!UWorld::Tick() + 2971 bytes [d:\programs\unrealengine-4.7.1\engine\source\runtime\engine\private\leveltick.cpp:1114] UE4Editor_UnrealEd!UEditorEngine::Tick() + 5618 bytes [d:\programs\unrealengine-4.7.1\engine\source\editor\unrealed\private\editor.cpp:1329] UE4Editor_UnrealEd!UUnrealEdEngine::Tick() + 22 bytes [d:\programs\unrealengine-4.7.1\engine\source\editor\unrealed\private\unrealedengine.cpp:347] UE4Editor!FEngineLoop::Tick() + 4179 bytes [d:\programs\unrealengine-4.7.1\engine\source\runtime\launch\private\launchengineloop.cpp:2257] UE4Editor!GuardedMain() + 1404 bytes [d:\programs\unrealengine-4.7.1\engine\source\runtime\launch\private\launch.cpp:142] UE4Editor!GuardedMainWrapper() + 26 bytes [d:\programs\unrealengine-4.7.1\engine\source\runtime\launch\private\windows\launchwindows.cpp:126] UE4Editor!WinMain() + 249 bytes [d:\programs\unrealengine-4.7.1\engine\source\runtime\launch\private\windows\launchwindows.cpp:202] UE4Editor!__tmainCRTStartup() + 329 bytes [f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c:618]

The problem appears to be kinda blocking, so i cannot really proceed further with the tutorials, where all others depends on the functionality of picking up an actor from the world.

Product Version: Not Selected
Tags:
more ▼

asked Mar 03 '15 at 02:19 PM in C++ Programming

avatar image

preslav
6 1 2 2

avatar image preslav Mar 05 '15 at 05:16 PM

It is rather weird but I resolved the problem just by removing the code concerning the problematic component, and then reentering it again. Looks like the building tool did some miraculous things in the background.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hi,

The assert seems to be complaining about component attachment in your constructor, which looking at the tutorial seems unrelated to the CollectBatteries() function (aside from it uses the component in question).

It looks like you should be calling ObjectInitializer.CreateDefaultSubObject(), rather than just CreateDefaultSubObject() to create your SphereComponent. This should create a 'template' component rather than an 'instanced' component in your constructor.

more ▼

answered Mar 04 '15 at 10:11 AM

avatar image

Tom Sarkanen STAFF
1.7k 39 12 53

avatar image preslav Mar 04 '15 at 03:52 PM

I have tested the solution you proposed before posting here, but it did not help me.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question