Call a Function When App Exits

I’m working on an iOS game right now, and I need a function to be called whenever the app is sent to the background, or exited. Is there something that can do this?

You can call something using OnApplicationQuit

OnApplicationPause() is the one you want for iOS when you send the app to background!

yes, check this quick search for events “onApplication”

I think you might find them interesting:
http://unity3d.com/support/documentation/ScriptReference/30_search.html?q=onapplication

iOS applications are usually suspended and do not quit. You should tick “Exit on Suspend” in Player settings for iOS builds to cause the game to quit and not suspend, otherwise you may not see this call. If “Exit on Suspend” is not ticked then you will see calls to OnApplicationPause instead.