# SendMessageUpwards(string, object, SendMessageOptions)

> Calls the specified method on every MonoBehaviour attached to the GameObject and on every ancestor of the behaviour.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.0/script-reference/unityengine.md)
* **Assembly:** UnityEngine.CoreModule

## SendMessageUpwards(string, Object, SendMessageOptions)

```csharp
public void SendMessageUpwards(string methodName, object value, SendMessageOptions options)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name of the MonoBehaviour method to call.**** (\[Object]\(https\://learn.microsoft.com/dotnet/api/system.object)): An optional parameter value to pass to the called method.**** (\[SendMessageOptions]\(/engine/6000.0/script-reference/unityengine/sendmessageoptions)): Whether an error should be raised if the method doesn't exist on the target object.

### Remarks

A `value` parameter specified for a method that doesn't accept parameters is ignored. If `options` is set to [SendMessageOptions.RequireReceiver](/engine/6000.0/script-reference/unityengine/sendmessageoptions/requirereceiver.md) an error is printed when the message is not picked up by any component.

**Note**: Messages are not sent to MonoBehaviours attached to objects for which [GameObject.activeSelf](/engine/6000.0/script-reference/unityengine/gameobject/activeself.md) or [GameObject.activeInHierarchy](/engine/6000.0/script-reference/unityengine/gameobject/activeinhierarchy.md) are `false`.

```csharp
using UnityEngine;

public class Example : MonoBehaviour
{
    void Start()
    {
        // Calls the function ApplyDamage with a value of 5
        gameObject.SendMessageUpwards("ApplyDamage", 5.0);
    }
}

public class Example2 : MonoBehaviour
{
    public void ApplyDamage(float damage)
    {
        print(damage);
    }
}
```

Additional Resources: [MonoBehaviour](/engine/6000.0/script-reference/unityengine/monobehaviour.md), [GameObject.SendMessage](/engine/6000.0/script-reference/unityengine/gameobject/sendmessage.md)
