mardi 16 janvier 2018

Hook to function without delegates (Reflection)

Is there a way I could use reflection to hook one function to another without using delegates?

class A
{
    Foo()
    {
    }
}

class B
{
    Func()
    {
    }
}

Is there a way to call Func after Foo was called without using events, delegates or just calling Func from inside Foo? I'm using this for the UI in a Unity game I'm making and I don't want to add a bunch of events to my classes just for UI, this seems a messy way to do it (I think most people do it this way but I don't like it).





Aucun commentaire:

Enregistrer un commentaire