For a while I’ve had a sphere component as an actor’s root.
TouchSphere = PCIP.CreateDefaultSubobject<USphereComponent>(this, TEXT("TouchSphereComponent"));
RootComponent = TouchSphere;
Recently I tried removing this and then got an endless loop opening a blueprint using this C++ actor.
Call stack is here:
> UE4Editor-BlueprintGraph.dll!TFieldIterator<UFunction>::IterateToNext() Line 2999 C++
UE4Editor-BlueprintGraph.dll!FindField<UFunction>(const UStruct * Owner, FName FieldName) Line 3067 C++
UE4Editor-BlueprintGraph.dll!FMemberReference::ResolveMember<UFunction>(UClass * SelfScope) Line 671 C++
UE4Editor-BlueprintGraph.dll!UK2Node_CallFunction::AllowMultipleSelfs(bool bInputAsArray) Line 1019 C++
UE4Editor-BlueprintGraph.dll!UEdGraphSchema_K2::CanCreateConnection(const UEdGraphPin * PinA, const UEdGraphPin * PinB) Line 1878 C++
UE4Editor-KismetCompiler.dll!FKismetCompilerContext::ValidateLink(const UEdGraphPin * PinA, const UEdGraphPin * PinB) Line 298 C++
UE4Editor-KismetCompiler.dll!FGraphCompilerContext::ValidatePin(const UEdGraphPin * Pin) Line 50 C++
UE4Editor-KismetCompiler.dll!FKismetCompilerContext::ValidatePin(const UEdGraphPin * Pin) Line 320 C++
UE4Editor-KismetCompiler.dll!FGraphCompilerContext::ValidateNode(const UEdGraphNode * Node) Line 65 C++
UE4Editor-KismetCompiler.dll!FKismetCompilerContext::CreateAndProcessUbergraph() Line 2752 C++
UE4Editor-KismetCompiler.dll!FKismetCompilerContext::CreateFunctionList() Line 3136 C++
UE4Editor-KismetCompiler.dll!FKismetCompilerContext::Compile() Line 3389 C++
UE4Editor-KismetCompiler.dll!FKismet2CompilerModule::CompileBlueprintInner(UBlueprint * Blueprint, const FKismetCompilerOptions & CompileOptions, FCompilerResultsLog & Results, TArray<UObject *,FDefaultAllocator> * ObjLoaded) Line 87 C++
UE4Editor-KismetCompiler.dll!FKismet2CompilerModule::CompileBlueprint(UBlueprint * Blueprint, const FKismetCompilerOptions & CompileOptions, FCompilerResultsLog & Results, FBlueprintCompileReinstancer * ParentReinstancer, TArray<UObject *,FDefaultAllocator> * ObjLoaded) Line 128 C++
UE4Editor-UnrealEd.dll!FKismetEditorUtilities::CompileBlueprint(UBlueprint * BlueprintObj, bool bIsRegeneratingOnLoad, bool bSkipGarbageCollection, bool bSaveIntermediateProducts, FCompilerResultsLog * pResults) Line 742 C++
UE4Editor-Kismet.dll!FBlueprintEditor::Compile() Line 2990 C++
UE4Editor-Kismet.dll!TBaseSPMethodDelegateInstance<0,FBlueprintEditor,0,TTypeWrapper<void> __cdecl(void)>::Execute() Line 282 C++
UE4Editor-Kismet.dll!TBaseSPMethodDelegateInstance<0,FBlueprintEditor,0,void __cdecl(void)>::ExecuteIfSafe() Line 388 C++
UE4Editor-Slate.dll!FUICommandList::ExecuteAction(const TSharedRef<FUICommandInfo const ,0> InUICommandInfo) Line 73 C++
UE4Editor-Slate.dll!SToolBarButtonBlock::OnClicked() Line 296 C++
UE4Editor-Slate.dll!TMemberFunctionCaller<SToolBarButtonBlock,FReply (__cdecl SToolBarButtonBlock::*)(void) __ptr64>::operator()<>() Line 161 C++
Putting the component back in fixes the endless loop, but doesn’t help me in my experiments.
There are a few questions I’d like to ask that would help me investigate this issue. What was happening to the root component after removing the sphere component? Was it being set to another component of that class? Do you also crash if you try to create a new blueprint from this class after removing the sphere component?
I’ve attached an image of the actor layout and the construction script, though I suspect its not the blueprint layout that is causing the problem.
The attachments are scene components used as positions for code to attach other actors.
Setting a break point in PostInitializeComponents the RootComponent was a valid pointer - set to
Making a duplicate I found that this new BP also has an endless look when pressing compile (though it looks like the game can compile the BP on load - perhaps this is a manual compile specific error checking issue?).
A completely new BP, based on this C++ actor (without the touch sphere) DOES NOT have an endless loop.
I made a duplicate and removed the “Attach:XXX” nodes before compiling - that worked. Added replacements also seem okay.
I’m still not sure what’s happening with the root component after you remove the Sphere Component. Are you setting it to another component in code? What exactly are you trying to accomplish without the sphere component? My understanding is that you’ve created a class based on actor with a sphere component set as the root component. You then create a blueprint based on the class and then remove the sphere component from the code? Does the endless loop occur when trying to compile the blueprint or when playing in the editor?
I’m removing the sphere as part of a process of setting up my actors in a more streamlined way, it only existed because I copied code when I first setup a new actor class and all the functionality I want seems to work well without it.
This issue is no longer causing me problems but seems like something that should be fixed as I got stalled for a bit on it, and others will too.
Are you setting it to another component in code? No the engine automatically promotes the mesh component to be the RootComponent.
What exactly are you trying to accomplish without the sphere component? Simplification - it never really needed to exist as far as I can tell.
My understanding is that you’ve created a class based on actor with a sphere component set as the root component. You then create a blueprint based on the class and then remove the sphere component from the code? Yes - see image above at the point I remove the sphere it has several child components - the “attach” nodes are scene components.
Does the endless loop occur when trying to compile the blueprint or when playing in the editor? When trying to compile. I suspect that the editor successfully compiles the blueprint when loading and its just a verification step that has the problem (ValidateNode)..
Let me know if I can provide any more information!
I tried creating an actor class and define a sphere component pointer. After creating a blueprint and adding scene components to it inside the editor I removed the sphere component from code and compiled again. When I tried to compile the blueprint after I received Internal Compiler Errors related to the scene components. Can you conform the endless loop in a new project and if so please list the steps you took that caused it.
I’ll have a go at a new project repro. Can you confirm that you built a blueprint network for the test actor (something like the above network, though I think that actor also had event handlers)?
I set the blueprint construction script as you have it in your screenshot. I still got the same Internal Compiler Errors with the scene components when I try to compile the blueprint after removing the sphere component from the code class. Are you able to confirm the endless loop in a new project?
In my first attempt to repro I hit a check/crash in 4.8.0 Preview 3.
Steps to check/crash:
From editor create C++ class based on AActor. Close project.
From VS project created add TouchSphere and run from VS.
Add Cube mesh, called Bob.
Add Scene components, named as above, each with a Tag called “Attach”
Add a construction script assigning a MID to Bob
Edit code to remove TouchSphere root and hit compile in editor.
> UE4Editor-UnrealEd.dll!operator<<(FArchive & Ar, FTransaction::FObjectRecord & R) Line 156 C++
UE4Editor-UnrealEd.dll!operator<<(FArchive & Ar, TArrayFTransaction::FObjectRecord,FDefaultAllocator & A) Line 1212 C++
UE4Editor-UnrealEd.dll!operator<<(FArchive & Ar, TArray<FTransaction,FDefaultAllocator> & A) Line 1212 C++
UE4Editor-UnrealEd.dll!UTransBuffer::Serialize(FArchive & Ar) Line 405 C++
UE4Editor-UnrealEd.dll!TFindObjectReferencers::TFindObjectReferencers(TArray<UObject *,FDefaultAllocator> TargetObjects, UPackage * PackageToCheck, bool bIgnoreTemplates) Line 513 C++
[2015.05.21-21.04.11:154]LogBlueprint:Warning: USimpleConstructionScript::FixupRootNodeParentReferences() - Couldn’t find native parent component ‘TouchSphereComponent’ for ‘Attach:Left’ in BlueprintGeneratedClass ‘CanICrashIt_C’ (it may have been removed)
[2015.05.21-21.04.11:155]LogBlueprint:Warning: USimpleConstructionScript::FixupRootNodeParentReferences() - Couldn’t find native parent component ‘TouchSphereComponent’ for ‘Attach:Right’ in BlueprintGeneratedClass ‘CanICrashIt_C’ (it may have been removed)
Assertion failed: Object [File:D:\BuildFarm\buildmachine_++depot+UE4-Releases+4.8\Engine\Source\Editor\UnrealEd\Private\EditorTransaction.cpp] [Line: 156]
UE4Editor.exe has triggered a breakpoint.
No endless loop though when I relaunched.
I’ve attached the even network - not sure if the OnClicked event was originally pointing at the Touch sphere component or not.
Clicked is a function on the actor exposed to blueprint.
I’m trying to run through the steps you posted and I just want to check that at step 3 if you’re adding the the cube mesh (Bob) in the code or through the editor? At what point do you create the blueprint? Please elaborate on your setup and I will continue testing this on my end.
Hi , through the editor. Only the Sphere was added through code and the editor was launched after this code was added.
Then added the rest of the components in the editor and removed the sphere from code without rebooting.
Regarding the original issue, its obviously a pretty low frequency problem and there is a workaround - if the engineer who knows the code best can’t see the problem based on my original information it might be worth just having them add some diagnostics code to better understand it next time it’s hit.
My solution was to avoid compiling the original blueprint, create a new blueprint based on the C++ actor and copy as much data from the broken type as possible across, it didn’t take too long once I’d decided to do it. Once complete I deleted the original and renamed my new type.