2D Toolkit Forum
2D Toolkit => Support => Topic started by: hasean on September 20, 2013, 08:23:30 am
-
Hello. I'm using AnimateShowWindow() in my project. That function also call coTweenTransformTo() where calculates the speed of transforming using tk2dUITime.deltaTime.
At first scene start everything works great, the problem begins after load new or reload scene.
For ex: First scene start, my player reached finish collider and a window with totals appears in 0.5f at this moment tk2dUITime.deltaTime equals ~0.013 and everything is ok. Then I press retry button and scene reloads with Application.LoadLevel(Application.loadedlevel) at this moment tk2dUITime.deltaTime still equals ~0.013, then my player get in collision with finish collider again, and at this moment tk2dUITime.deltaTime become equals ~1-9, and window with totals appears very very very slowly.
Dear 2dToolKit team pls advise. Of course I can replace tk2dUITime.deltaTime with 0.013f, i tried it and it works good, but i'm not sure this is professional solving the problem.
Thx!
-
Hmm... Do you have 2 uimanagers in the scene when this happens? Theres a bug in 2.2 where a second UI manager may exist and isn't deleted properly. In tk2dUIManager.cs, add the line in bold:
//can only be one tk2dUIManager at one-time, if another one is found Destroy it
if (instance != this)
{
Debug.Log("Discarding unnecessary tk2dUIManager instance.");
Destroy(this);
return;
}
-
Yes, when scene reloads Gameobject with tk2dUIManager duplicates. After adding Destroy(this); GameObject still duplicates but without tk2dUIManager.cs component and UI Buttons stop working... :(
-
Do you have a tk2dUICamera script attached to your camera? That is the preferred way to work with this in tk2d 2.2 - in most cases you don't need the kt2dUIManager at all. Try attaching that - I'll investigate trying to deal with this in a more robust way.
-
I use your tk2dCamera and it is hooked up in uimanager. Do you suggest to remove this camera, create unity usual camera nad attach tk2dUICamera to it and delete uimanager? Am i right?
-
Seems that solves the problem. But what about setting that were in tk2dCamera?
-
tk2dUICamera is just something to tell the UI system that the camera is used for UI. You can attach it to a tk2dCamera, or a normal camera even a perspective camera if you'd like. Its independent to the tk2dCamera script.