unity know when a function is used code example
Example: find out which function called unity
At the top of your class, add this import:
using System.Diagnostics;
Then in your function:
string callingFuncName = new StackFrame(1).GetMethod().Name;