Fixed UCarlaLight related crash
This commit is contained in:
parent
717295e553
commit
808d00d0b0
|
@ -222,7 +222,7 @@ void ACarlaGameModeBase::BeginPlay()
|
|||
Actor->GetComponents(Lights, false);
|
||||
for(UCarlaLight* Light : Lights)
|
||||
{
|
||||
Light->BeginPlay();
|
||||
Light->RegisterLight();
|
||||
}
|
||||
}
|
||||
EnableOverlapEvents();
|
||||
|
|
|
@ -14,20 +14,26 @@ UCarlaLight::UCarlaLight()
|
|||
}
|
||||
|
||||
void UCarlaLight::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
RegisterLight();
|
||||
}
|
||||
|
||||
void UCarlaLight::RegisterLight()
|
||||
{
|
||||
if(bRegistered)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Super::BeginPlay();
|
||||
|
||||
UWorld *World = GetWorld();
|
||||
if(World)
|
||||
{
|
||||
UCarlaLightSubsystem* CarlaLightSubsystem = World->GetSubsystem<UCarlaLightSubsystem>();
|
||||
CarlaLightSubsystem->RegisterLight(this);
|
||||
}
|
||||
|
||||
bRegistered = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,9 @@ public:
|
|||
|
||||
void OnComponentDestroyed(bool bDestroyingHierarchy) override;
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Carla Light")
|
||||
void RegisterLight();
|
||||
|
||||
UFUNCTION(BlueprintImplementableEvent, BlueprintCallable, Category = "Carla Light")
|
||||
void UpdateLights();
|
||||
|
||||
|
|
Loading…
Reference in New Issue