SHARE
TWEET

Untitled

a guest Dec 7th, 2017 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #if WITH_EDITOR  
  2. void ARoom::PostEditChangeProperty(struct FPropertyChangedEvent& PropertyChangedEvent)
  3. {
  4.     //Get all of our components  
  5.     TArray<UActorComponent*> MyComponents;
  6.     GetComponents(MyComponents);
  7.  
  8.     //Get the name of the property that was changed  
  9.     FName PropertyName = (PropertyChangedEvent.Property != nullptr) ? PropertyChangedEvent.Property->GetFName() : NAME_None;
  10.  
  11.     // We test using GET_MEMBER_NAME_CHECKED so that if someone changes the property name  
  12.     // in the future this will fail to compile and we can update it.  
  13.     if ((PropertyName == GET_MEMBER_NAME_CHECKED(ARoom, DoorwayCount)))
  14.     {
  15.         //FMultiComponentReregisterContext ReregisterContext(MyComponents);
  16.         if (DoorWays.Num() < DoorwayCount)
  17.         {
  18.             UE_LOG(LogTemp, Warning, TEXT("Updated DoorWays %d"), DoorwayCount);
  19.             for (int32 i = 0; i < DoorwayCount - DoorWays.Num(); i++)
  20.             {
  21.                 //DoorWays.Add(ConstructObject<UBoxComponent>(UBoxComponent::StaticClass, this));//*FString("Doorway").Append(FString::FromInt(i))
  22.                 UBoxComponent* NewBoxComp = NewObject<UBoxComponent>(this, UBoxComponent::StaticClass(), *FString("Doorway").Append(FString::FromInt(i)));
  23.                 if (NewBoxComp != NULL)
  24.                 {
  25.                     DoorWays.Add(NewBoxComp);
  26.                     UE_LOG(LogTemp, Warning, TEXT("Added Doorway %d"), DoorWays.Num());
  27.                 }
  28.                 else
  29.                 {
  30.                     UE_LOG(LogTemp, Warning, TEXT("Didn't AddDoorway, as its null %d"), DoorWays.Num());
  31.                 }
  32.             }
  33.         }
  34.     }
  35.  
  36.     // Call the base class version  
  37.     Super::PostEditChangeProperty(PropertyChangedEvent);
  38. }
  39. #endif
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top