Unreal Crashed because one of my scripts..

Hi…

After working on my Interruptor.h class (and .cpp) save it and then trying to compile it, Unreal crashed, the report says:



AInterruptor::AInterruptor() Address = 0x164f984eb [/Users/Shared/Epic Games/UE_4.21/Engine/Source/Runtime/Engine/Classes/GameFramework/Actor.h, line 2728] [in UE4Editor-X01-8166.dylib]
UClass::CreateDefaultObject() Address = 0x10d12820c (filename not found) [in UE4Editor-CoreUObject.dylib]
ProcessNewlyLoadedUObjects() Address = 0x10d455da7 (filename not found) [in UE4Editor-CoreUObject.dylib]
TBaseStaticDelegateInstance<void ()>::ExecuteIfSafe() const Address = 0x10d1a6917 (filename not found) [in UE4Editor-CoreUObject.dylib]
TBaseMulticastDelegate<void>::Broadcast() const Address = 0x10c2a7d15 (filename not found) [in UE4Editor-Core.dylib]
FModuleManager::LoadModuleWithFailureReason(FName, EModuleLoadResult&) Address = 0x10c5a88af (filename not found) [in UE4Editor-Core.dylib]
FModuleDescriptor::LoadModulesForPhase(ELoadingPhase::Type, TArray<FModuleDescriptor, FDefaultAllocator> const&, TMap<FName, EModuleLoadResult, FDefaultSetAllocator, TDefaultMapHashableKeyFuncs<FName, EModuleLoadResult, false> >&) Address = 0x1130f3ac2 (filename not found) [in UE4Editor-Projects.dylib]
FProjectManager::LoadModulesForProject(ELoadingPhase::Type) Address = 0x1131161c2 (filename not found) [in UE4Editor-Projects.dylib]
FEngineLoop::LoadStartupModules() Address = 0x10c15743b (filename not found) [in UE4Editor]
FEngineLoop::PreInit(wchar_t const*) Address = 0x10c13a885 (filename not found) [in UE4Editor]
GuardedMain(wchar_t const*) Address = 0x10c14f15f (filename not found) [in UE4Editor]
-[UE4AppDelegate runGameThread:] Address = 0x10c15c880 (filename not found) [in UE4Editor]
-[FCocoaGameThread main] Address = 0x10c407e67 (filename not found) [in UE4Editor-Core.dylib]
Unknown() Address = 0x7fff35d81104 (filename not found) [in Foundation]
_pthread_body Address = 0x7fff60ee5305 (filename not found) [in libsystem_pthread.dylib]
_pthread_start Address = 0x7fff60ee826f (filename not found) [in libsystem_pthread.dylib]
thread_start Address = 0x7fff60ee4415 (filename not found) [in libsystem_pthread.dylib]


As you can see, the first line says that AInterruptor class is having a problem, well, what I did is to delete the class out of unreal (unreal and visual studio closed), but still having the same error (I have deleted both .h and .cpp)… have no idea why is report is still showing me the related to Interruptor.h class error…

Any clues?
Thanks so much.

I have isolated the problem… this is :




//Interruptor.h

UPROPERTY(EditAnywhere)
AActor * targetLight;

class UPointLightComponent * targetLightC;




//Interruptor.cpp

AInterruptor::AInterruptor(){

     targetLightC = targetLight->FindComponentByClass<UPointLightComponent>();         //This line is getting Unreal crashing.

}



I know that there is a memory access violation since targetLight is null, is there any way to get UPointLightComponent from targetLight Actor ?
Thanks.

Hi!
You could use:
PostInitProperties: http://api.unrealengine.com/INT/API/Runtime/Engine/GameFramework/AActor/PostInitProperties/index.html
or
BeginPlay: AActor::BeginPlay | Unreal Engine Documentation

Don’t forget to check if it is NULL!

Thanks friend, this question is slightly related to the other you answered too, I will try with PostInitProperties…