Muk Supports show a new scene with native-like animation (Slider for iOS, fade scale for material design).
Since the animation need to show both scenes at some time, so Muk uses LoadSceneMode.Additive for the new scenes. That means new scenes are added on top of the old scene(they exist at the same time.
You can go to the new scene by calling the code shown below.
Note, you can use the ReplaceScene function, to load a scene and remove all other scene. But you will need to handle additional stuff.
For example:
1. Remove the nav bar’s back button. Since Muk will remove it after the scene is loaded, so there will be short period of time, the back button will display on the screen. (If you don’t want this odd behaviour, you can simple remove the left button object in the nav bar children.)
2. Set the camera’s priority to higher for the previous scene, so that animation can show properly. If both scenes camera’s priorities are same. Then the new scene will be under the old scene, which will seem odd. You will need to set the old scene’s camera priority higher.
If you face any other odd behaviour, please let me know, I will see how to fix that. Since it can have unlimited combinations. I cannot test all the scenarios. Apologise if the function is not as direct as you want.
using Muk;
// Go to Scene with platform type animation
public void GotoScene(string sceneName)
{
MukSceneManager.Instance.GoToScene(sceneName);
}
// Go to Scene with iOS animation
public void GotoSceneWithIosAnimation(string sceneName)
{
MukSceneManager.Instance.GoToScene(sceneName, SCENE_ANIMATION_TYPE.IOS_SLIDE);
}
// Go to Scene with Material animation
public void GotoSceneWithMaterialAnimation(string sceneName)
{
MukSceneManager.Instance.GoToScene(sceneName, SCENE_ANIMATION_TYPE.MATERIAL_SCALE_FADE);
}
// Fade to the scene
public void GotoSceneWithFadeAnimation(string sceneName)
{
MukSceneManager.Instance.GoToScene(sceneName, SCENE_ANIMATION_TYPE.FADE);
}
// Load the scene and remove all the previous scene.
public void GotoSceneAndRemoveOldScene()
{
MukSceneManager.Instance.ReplaceScene("SceneToReplace");
}
Swipe gesture #
Muk support slide/swipe gesture just like native mobile apps. For iOS when the user is in a new scene, they can slide from the left / swipe back to the previous page. Muk will show the native-like animation as well.
Working on a new scene #
Please use only one camera in the project for the Muk Components. Muk uses Screen Space – Camera in MukUICanvas, and Muk will auto-assign MainCamera to the canvas. All the scenes are going to be loaded on top of each other. That means if you have a new camera in each scene, the old scene will get covered by the new scene.
You can add a temporary camera while you are building the UI to preview the changes. But remember to remove the camera when you are done.
We suggest working on the scenes all together, you can simply drag and drop the scene in the Hierarchy Window while the root scene is open.