Hi all,
I have a problem: one of dll’s which I use sends SendMessage to all objects on scene when my player is destroyed. I cant decompile dll and I cant change dll. So, is there posibility to “mark” GameObject as no-SendMessage GameObject or sth like that?
The only way is to set the GameObject to inactive ( gameObject.SetActive(false);
) but then, a lot more things get deactivated as well (i.e. rendering, Update calls, collisions etc…)
However, if you control the source of the script that is receiving the messages, you can just add your own “shouldThisBeHandled” flag into your components or rename the function (if you never want this to be called).
For example:
class Foo : MonoBehaviour
{
// set this to false for all objects you don't like the SendMessage
public bool shouldNastyMessageBeHandled = true;
// this is called from some external DLL
void MyMessageCallback()
{
if (!shouldNastyMessageBeHandled) return;
...
}
}