// call when this event happens public void OnSceneSwap(object o, SceneSwapEventArgs e) { // this is vurnerable to exceptions thrown in the handler methods if(SceneSwap != null){ SceneSwap(o, e); } }
void HandleSceneSwap(object o, SceneSwapEventArgs e) { int li = GetLoadingIndex(e.SceneName); loadPicture = li==-1?defaultPicture:loadingPictures[li]; loadText = li==-1?"Ladataan...":loadingTexts[li]; loadPictureRect = new Rect((Screen.width - loadPicture.width)/2, 0,loadPicture.width, loadPicture.height); print (loadPictureRect); display = true; loadStarted = Time.realtimeSinceStartup; }