# Delegate Broadcasted from UStruct and Subscribed from UClass

**URL:** <https://forums.unrealengine.com/t/delegate-broadcasted-from-ustruct-and-subscribed-from-uclass/491487>\
**Category:** Editor Scripting\
**Tags:** ustruct, UClass, unreal-engine, delegates, CPP, question\
**Created:** [December 1, 2021, 5:06pm UTC](https://forums.unrealengine.com/t/delegate-broadcasted-from-ustruct-and-subscribed-from-uclass/491487 "2021-12-01T17:06:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![anil021](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anil021](https://forums.unrealengine.com/u/anil021)\
**Post date:** [December 1, 2021, 5:06pm UTC](https://forums.unrealengine.com/t/delegate-broadcasted-from-ustruct-and-subscribed-from-uclass/491487/1 "2021-12-01T17:06:30Z")

</div>

Hello, I have a ustruct to hold some attributes like health. Whenever a change occurs in this attribute, I wan’t to fire a delegate. Subscribed uobjects will act differently depending on their function. For a brief example this code is what I want to achieve.

Let’s say my struct file looks something like this :

```
DECLARE_MULTICAST_DELEGATE(FOnChangeEvent)

USTRUCT()
struct FMyAttribute
{
    GENERATED_BODY()

    FOnChangeEvent OnChangeEvent;

    float MyValue ;
    void SetFloat(const float NewValue)
    {
        MyValue = NewValue;
        OnChangeEvent.Broadcast();        
    }
}

```

And let’s say I have a MyAttribue member in my uclass header and this is my uclass.cpp file :

```
void MyClass::BeginPlay()
{
    Super::BeginPlay();
    MyAttribute.OnChangeEvent.AddUObject(this, &MyClass::MySubscribeFunc);
}

void MyClass::MySubscribeFunc()
{
    UE_LOG(LogTemp, Warning, TEXT("Hey I Recieved!") );
}

```

So the problem is, MySubscribeFunc is not subscribing to delegate. I checked OnChangeEvent.IsBound() after calling AddUObject and it returns false.  
If I change my struct to a uclass, everything works. So, Is there anyway to make it work with UStructs or must I always use UClass to broadcast a delegate whenever I want to recieve it from another UClass ?
