Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #if WITH_EDITOR
- void ARoom::PostEditChangeProperty(struct FPropertyChangedEvent& PropertyChangedEvent)
- {
- //Get all of our components
- TArray<UActorComponent*> MyComponents;
- GetComponents(MyComponents);
- //Get the name of the property that was changed
- FName PropertyName = (PropertyChangedEvent.Property != nullptr) ? PropertyChangedEvent.Property->GetFName() : NAME_None;
- // We test using GET_MEMBER_NAME_CHECKED so that if someone changes the property name
- // in the future this will fail to compile and we can update it.
- if ((PropertyName == GET_MEMBER_NAME_CHECKED(ARoom, DoorwayCount)))
- {
- //FMultiComponentReregisterContext ReregisterContext(MyComponents);
- if (DoorWays.Num() < DoorwayCount)
- {
- UE_LOG(LogTemp, Warning, TEXT("Updated DoorWays %d"), DoorwayCount);
- for (int32 i = 0; i < DoorwayCount - DoorWays.Num(); i++)
- {
- //DoorWays.Add(ConstructObject<UBoxComponent>(UBoxComponent::StaticClass, this));//*FString("Doorway").Append(FString::FromInt(i))
- UBoxComponent* NewBoxComp = NewObject<UBoxComponent>(this, UBoxComponent::StaticClass(), *FString("Doorway").Append(FString::FromInt(i)));
- if (NewBoxComp != NULL)
- {
- DoorWays.Add(NewBoxComp);
- UE_LOG(LogTemp, Warning, TEXT("Added Doorway %d"), DoorWays.Num());
- }
- else
- {
- UE_LOG(LogTemp, Warning, TEXT("Didn't AddDoorway, as its null %d"), DoorWays.Num());
- }
- }
- }
- }
- // Call the base class version
- Super::PostEditChangeProperty(PropertyChangedEvent);
- }
- #endif
Add Comment
Please, Sign In to add comment