UI screen transition system using uGUI. Supports full screen screens and dialogs.
- Create a new script and add "using Pspkurara.Sceneries".
- Inherits the "Scene" class.
- Override virtual functions to describe scene processing.
- Build a scene prefab based on the template, attach the script to the prefab, and save it in a folder. (Default is Resources/Sceneries/{prefab name})
- Load a scene by calling the "SceneriesManager.LoadScene(scene name)" function from another scene.
- Set the initial scene name to "Initialize Load Sceneries Name" in the "SceneriesManager" prefab.
using UnityEngine;
using Pspkurara.Sceneries;
using Cysharp.Threading.Tasks;
using UnityEngine.UI;
// This is a scene sample of screen transition..
public class SampleTitleScene : Scene
{
[SerializeField] private Button m_GoMenuButton;
// initialize scene.
protected override UniTask OnInstancedScene()
{
// add the move scene function.
m_GoMenuButton.onClick.AddListener(() =>
{
SceneriesManager.LoadScene("SampleMenuScene");
});
return base.OnInstancedScene();
}
}
- Create a new script and add "using Pspkurara.Sceneries.Dialogs".
- Inherits the "Dialog" class. but most of the time you want a button, so extend "ArrayButtonDialog" instead.
- Override virtual functions to describe scene processing.
- Build a scene prefab based on the template, attach the script to the prefab, and save it in a folder. (Default is Resources/Dialogs/{prefab name})
- Load a dialog by calling the "DialogManager.ShowDialog(dialog name, dialog initializer).Forget()" function from another scene.
using UnityEngine;
using UnityEngine.UI;
using Pspkurara.Sceneries.Dialogs;
// simple the title and message dialog sample.
public class SampleMessageDialog : ArrayButtonsDialog
{
[SerializeField] private Text m_Title;
[SerializeField] private Text m_Message;
// set title.
public void SetTitle(string title)
{
m_Title.text = title;
}
// set message.
public void SetMessage(string message)
{
m_Message.text = message;
}
}
// add the show dialog function.
m_ShowDialog.onClick.AddListener(() =>
{
DialogManager.ShowDialog<SampleMessageDialog>("SampleMessageDialog", (dialog) =>
{
dialog.SetTitle("Sample Dialog");
dialog.SetMessage("Sample Dialog Details");
dialog.SetActiveButtons(1);
dialog.SetButtonTitle(0, "Close");
dialog.SetButtonCallback(0, dialog.Close);
}).Forget();
});
- Attaches a "StandardSceneTransition" to a Scene or Dialog attached object. (Another option is "PlayableSceneTransition" using the timeline)
- Set the animation by referring to DefaultSceneTransition and DefaultSceneLoader in Templates. (If you edit at will, please copy or create from "Create/Pspkurara/Sceneries/Standard Scene Transition Setting")
- Animation will work if you attach it to the "Setting" of the screen.
- Setting the "Allow Duplicate Playback" flag to true will animate the screen before and after the transition at the same time.
Go to Unity's project folder on the command line and call:
openupm add com.pspkurara.sceneries
Find the manifest.json file in the Packages folder of your project and edit it to look like this:
{
"dependencies": {
"com.pspkurara.sceneries": "https://github.com/pspkurara/sceneries.git#upm",
...
},
}
Unity 2018.1 or later
May work in Unity5, but unofficial.
- GitHub page : https://github.com/pspkurara/sceneries