Delegate Event is Always null no matter what

I have this code:

private void Awake()
    {
        onLanguageChanged = GameObject.Find(ObjectNames.LanguageManager_NAME).
            GetComponent<SelectLanguage>().onLanguageChanged;

        languageManager =                        GameObject.Find(ObjectNames.LanguageManager_NAME).GetComponent<LanguageManager>();

        onLanguageChanged += UpdateTextLanguage;
}

The indents being messed up is not in my code just the forum. Even though I’m adding a function the delegate is always null, what’s going wrong?

onLanguageChanged = GameObject.Find(ObjectNames.LanguageManager_NAME).GetComponent<SelectLanguage>().onLanguageChanged;

I believe due to the weird nature of delegates, this isn’t doing what you imagine it to be doing. Namely, while delegates are reference types, they are immutable, thus when you do this assignment it actually makes a new delegate rather than pointing to the desired one (this is probably a very poor explanation).

Instead you would get a reference to the SelectLanguage component, and then cast a method into it’s delegate property.

Thanks it worked.