I will gather all the code that makes this and show you it all and you point out the bug to me. and lets completely forget about compare and concentrate on the if bug. I will have the code up in half hour or so. Have a few things to do here this morning before i can up the code.
Here is the code
void AWeatherSystem::BeginPlay()
{
bool bWeatherFound = false;
FName WeatherName = FName(TEXT("FLWeather"));
Super::BeginPlay();
TheLevel = GetLevel();
UE_LOG(LogWeather, Log, TEXT("AWeatherSystem::BeginPlay() *TheLevel is %s"), *TheLevel->GetName());
if (TheLevel != nullptr)
{
for (int32 i = 0; i < TheLevel->Actors.Num(); i++)
{
if (TheLevel->Actors*->IsA<AMatineeActor>())
{
class AMatineeActor* const SomeMatinee = Cast<AMatineeActor>(TheLevel->Actors*);
UE_LOG(LogWeather, Log, TEXT("AWeatherSystem::BeginPlay() SomeMatinee is %s"), *SomeMatinee->GetName());
//SomeMatinee->MatineeControllerName is set as "FLWeather"
if (SomeMatinee->MatineeControllerName == WeatherName)//will not let me in and it should as they match!
{
//defined in h file as AMatineeActor* CurrentMatinee; with FName as "FLWeather" set in properties in editor.
CurrentMatinee = Cast<AMatineeActor>(TheLevel->Actors*);
bWeatherFound = true;
UE_LOG(LogWeather, Log, TEXT("AWeatherSystem::BeginPlay() CurrentMatinee is %s"), *CurrentMatinee->GetName());
if (GetWorldTimerManager().IsTimerActive(TimerHandle_Weather))
{
GetWorldTimerManager().ClearTimer(TimerHandle_Weather);
}
}
}
}
if(bWeatherFound && (!GetWorldTimerManager().IsTimerActive(TimerHandle_Weather)))
{
bWeatherFound = false;
GetWorldTimerManager().SetTimer(TimerHandle_Weather, this, &AWeatherSystem::StartTheTimeLine, 1.0, true);
GEngine->AddOnScreenDebugMessage(-1, 1.1f, FColor::Green, FString::Printf(TEXT("Weather Matinee has Started up!")));
UE_LOG(LogWeather, Log, TEXT("Weather Matinee has Started up, LOAD THE REST UP! :)"));
UpdateTimeLine();
}
}
}
please point out the bug, thanks
You are logging SomeMatinee->GetName() but trying to compare SomeMatinee->MatineeControllerName
Log SomeMatinee->MatineeControllerName and WeatherName and you will see that they don’t match