Hi,
I am just in the process of creating my own scene transition manager. I know there are a lot around using GUI textures, but I wanted to try my own using only toolkit 2D features, with a 1x1 black px scaled sprite that overlays the screen and will be tweened over the alpha. This all works great for the fade-out, the new scene is loaded, but then the GO-child of the TransitionManager singleton holding the black sprite no longer has the generated sprite on board. The GO itself is not destroyed on load, and I have no clue why the sprite isn't surviving the loading. This is how I set up the TransitionManager singleton:
// create a black overlay for the whole screen
Texture2D fadeTexture = new Texture2D(1,1);
fadeTexture.SetPixel(0, 0, Color.black);
fadeTexture.Apply();
_fadeGO = tk2dSprite.CreateFromTexture(fadeTexture, tk2dSpriteCollectionSize.ForTk2dCamera(tk2dCamera.Instance),
new Rect(0,0,1,1), new Vector2(0.5f, 0.5f) );
_fadeGO.name = "Fader";
_fadeGO.transform.parent = transform;
_fadeGO.renderer.sortingLayerName = "Effects";
_fadeSprite = _fadeGO.GetComponent<tk2dSprite>();
_fadeSprite.scale = new Vector2(tk2dCamera.Instance.ScreenExtents.width/_fadeSprite.CurrentSprite.GetUntrimmedBounds().size.x,
tk2dCamera.Instance.ScreenExtents.height/_fadeSprite.CurrentSprite.GetUntrimmedBounds().size.y);
_fadeGO.SetActive(false);
DontDestroyOnLoad(this);
Is the tk2dUIManager somehow cleaning up sprites?
This is how it looks before the screen transition:
And this is the state after the new scene has been loaded:
Anything else that I need to do to save my little sprite over to the other side?
Thanks, habitoti