How can I cancel a function that is in another script? Thanks
Depends on what you mean cancel. You can use MonoBehaviour.CancelInvoke(). Any subclass of MonoBehaviour (all your scripts) will respond to that. So `myScript.CancelInvoke("MyMethod");`
Besides that your really can't. You can have a `bool` that will cancel the function before it runs. Since Unity is single-treaded you won't have two methods called at the same time (yes you can do multi-treading, but the Unity API is not tread-safe so multi-thread at your own discretion)
Or if you are doing a while loop, use a bool then make it false.
function Loop () {
while (shouldLoop) {
yield;
}
}
function BreakLoop () {
shouldLoop = false;
}