Is there a way to "Dubug.Log" which gameobject called a certain function?

LEt´s say I have 3 objects and all three of them can call a certain public function in a 4th script.
Is there a way to “Dubug.Log” which gameobject called that function?

You could put a Debug.Log(“Object 1 called method”) etc. after each line in which your method is called. Not the best but it’s simple enough

Thank you for your time, actually I can´t do that. The three objects call that method if a boolean is on, so that way it could tell me who called it, but it could be called many times. For reasons too complex to explain here I need to “debug.log” it from script 4. Thanks anyway!

There is a pretty simple workaround, all you have to do is create a gameobject variable and set it to null, the add a Debug.Log(yourVariable.name) inside the function you want to track and you’ll get an error in the console detailling the history of all function calls that eventually triggered your function.