Description

Attempting to add an instance to an Instance Static Mesh Component at runtime through code causes the editor to crash.

Steps to Reproduce
  1. Open UE4 Editor (any project)
  2. Add code to project based on Actor (MyActor)
  3. Add the following to MyActor.h
    • Include statement for InstancedStaticMeshComponent class
    • Add below tick() declaration
      UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Test)
      	FQuat NewRot;
      
      	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Test)
      		FTransform NewTrans;
      
      	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Test)
      		UInstancedStaticMeshComponent* InstMeshComp;
      
  4. Add the following to MyActor.cpp
    • Add to constructor
      	InstMeshComp = CreateDefaultSubobject<UInstancedStaticMeshComponent>(TEXT("InstMeshComp"));
      
      	NewRot.X = 45;
      	NewRot.Y = 45;
      	NewRot.Z = 45;
      	NewRot.W = 45;
      	
      	NewTrans.SetLocation(FVector(0, 0, 0));
      	NewTrans.SetRotation(NewRot);
      
    • Add to BeginPlay()
      InstMeshComp->AddInstance(NewTrans);
      
  5. Compile code
  6. Create blueprint based on MyActor (MyActorBP)
  7. Set Static Mesh for Inst Mesh Comp to 1M_Cube
  8. Add instance of MyActorBP to level
  9. PIE

Result:
Editor crashes with callstack

Expected:
Instance of 1M_Cube is added and given the desired rotation

Callstack
MachineId:7156C35640F86204E61B8383F45DEE17
EpicAccountId:e8c7fa630b6440f69a25a2c64d6c482c

Assertion failed: IsRotationNormalized() [File:d:\build\++ue4+release-4.12+compile\sync\engine\source\runtime\core\public\math\TransformVectorized.h] [Line: 1257] 



UE4Editor_Core!FDebug::AssertFailed() [d:\build\++ue4+release-4.12+compile\sync\engine\source\runtime\core\private\misc\outputdevice.cpp:440]
UE4Editor_Engine!UInstancedStaticMeshComponent::SetupNewInstanceData() [d:\build\++ue4+release-4.12+compile\sync\engine\source\runtime\engine\private\instancedstaticmesh.cpp:1657]
UE4Editor_Engine!UInstancedStaticMeshComponent::AddInstance() [d:\build\++ue4+release-4.12+compile\sync\engine\source\runtime\engine\private\instancedstaticmesh.cpp:1428]
UE4Editor_Engine!AWorldSettings::NotifyBeginPlay() [d:\build\++ue4+release-4.12+compile\sync\engine\source\runtime\engine\private\worldsettings.cpp:164]
UE4Editor_Engine!AGameMode::HandleMatchHasStarted() [d:\build\++ue4+release-4.12+compile\sync\engine\source\runtime\engine\private\gamemode.cpp:623]
UE4Editor_Engine!AGameMode::SetMatchState() [d:\build\++ue4+release-4.12+compile\sync\engine\source\runtime\engine\private\gamemode.cpp:733]
UE4Editor_Engine!AGameMode::StartMatch() [d:\build\++ue4+release-4.12+compile\sync\engine\source\runtime\engine\private\gamemode.cpp:600]
UE4Editor_Engine!UWorld::BeginPlay() [d:\build\++ue4+release-4.12+compile\sync\engine\source\runtime\engine\private\world.cpp:3218]
UE4Editor_Engine!UGameInstance::StartPIEGameInstance() [d:\build\++ue4+release-4.12+compile\sync\engine\source\runtime\engine\private\gameinstance.cpp:293]
UE4Editor_UnrealEd!UEditorEngine::CreatePIEGameInstance() [d:\build\++ue4+release-4.12+compile\sync\engine\source\editor\unrealed\private\playlevel.cpp:3250]
UE4Editor_UnrealEd!UEditorEngine::PlayInEditor() [d:\build\++ue4+release-4.12+compile\sync\engine\source\editor\unrealed\private\playlevel.cpp:2346]
UE4Editor_UnrealEd!UEditorEngine::StartQueuedPlayMapRequest() [d:\build\++ue4+release-4.12+compile\sync\engine\source\editor\unrealed\private\playlevel.cpp:1103]
UE4Editor_UnrealEd!UEditorEngine::Tick() [d:\build\++ue4+release-4.12+compile\sync\engine\source\editor\unrealed\private\editorengine.cpp:1246]
UE4Editor_UnrealEd!UUnrealEdEngine::Tick() [d:\build\++ue4+release-4.12+compile\sync\engine\source\editor\unrealed\private\unrealedengine.cpp:368]
UE4Editor!FEngineLoop::Tick() [d:\build\++ue4+release-4.12+compile\sync\engine\source\runtime\launch\private\launchengineloop.cpp:2775]
UE4Editor!GuardedMain() [d:\build\++ue4+release-4.12+compile\sync\engine\source\runtime\launch\private\launch.cpp:148]
UE4Editor!GuardedMainWrapper() [d:\build\++ue4+release-4.12+compile\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:126]
UE4Editor!WinMain() [d:\build\++ue4+release-4.12+compile\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:200]
UE4Editor!__scrt_common_main_seh() [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:264]
kernel32
ntdll

Have Comments or More Details?

Head over to the existingAnswerHub thread and let us know what's up.

7
Login to Vote

Won't Fix
ComponentRendering
Affects Versions4.12.5
Target Fix4.13
CreatedAug 9, 2016
ResolvedAug 9, 2016
UpdatedMay 2, 2018