Is any delegate handler can be registered when application start?

Start() or Awake() is belongs to component, and component must be attached on a GameObject, but a GameObject just belongs ONE scene. I have some stuff to do when any scene started, and I don’t want insert them by each scene. Any idea to archive that goal?

1 Answer

1

Use ScriptableObject for code that doesn’t belong to any GameObject. And see:

http://docs.unity3d.com/Documentation/ScriptReference/MonoBehaviour.OnLevelWasLoaded.html

for a delegate that might do what you want. (Or create a GameObject on start up that you mark as don’t destroy on load.

ScriptableObject is used as a 'getter' of global data. I know it.But I need a entry point of whole application and I want run some functions. I don't want any function be called by each scenes. Just like main() in C/C++, No matter how big of the application or how many functions or libraries are called, main() is always called and don't need any criteria at all. Anyway, thanks for replying.