ride_wind
Topic Author
Posts: 34
Joined: 07 Feb 2018, 03:33

How to notify array add changed in UE4 C++ code

12 Apr 2018, 05:49

Hi,

I create ViewModel using c++ code, and can use "UNoesisFunctionLibrary::NotifyChanged(this, IsTestName);" to notify property changed.

How to notify array add changed?

Thanks.
 
User avatar
hcpizzi
Site Admin
Posts: 316
Joined: 09 Feb 2012, 12:40

Re: How to notify array add changed in UE4 C++ code

12 Apr 2018, 10:48

You can use UNoesisFunctionLibrary::NotifyArrayChanged in much the same way, but that function is very coarse and not optimal.

NoesisTypeClass.h exposes more fine grained functions you can use. In your case, you want to use NoesisNotifyArrayPropertyAdd. The way to use it is that you pass the address of the array, like this:
UCLASS()
class UMyClass : public UObject
{
  UPROPERTY(BlueprintReadWrite)
  TArray<SomeType> MyArray;

  void AddSomething()
  {
    MyArray.Add(Something);
    NoesisNotifyArrayPropertyAdd(&MyArray);
  }
};

Who is online

Users browsing this forum: No registered users and 5 guests