This class follows the singleton pattern, the unique instance of the class can be found on an object with the tag "sceneManager". It has to be instanciate because the coroutines cant be used in static methods, so if you need to use the changeSceneWithAnimation method you have to have an instance of the class. It also has the public static method changeScene that allow change the active scene to other but without any transition.
More...
|
void | changeSceneWithAnimation (string sceneName, float transitionTime=1f, string text="Loading...") |
| this method starts a coroutine that execute the makeFadeInFadeOutAnimation method. More...
|
|
|
static void | changeScene (string sceneName) |
| This method tries to load the scene that have the given name, if there isnt any scene with the given name it will produce an exception. More...
|
|
|
void | Awake () |
| This method is called just before the first frame. It search for other sceneManager objects and if there is other one, it will destroy this instance. It also hide the text that will be showed during the fade in animation. More...
|
|
IEnumerator | makeFadeInFadeOutAnimation (string sceneName, float transitionTime, string text="Loading...") |
| this coroutine shows the given text, makes a fade in animation, change the scene, and then it does a fade out animation to hide both the text and the black image. All the process takes the given number of seconds. More...
|
|
This class follows the singleton pattern, the unique instance of the class can be found on an object with the tag "sceneManager". It has to be instanciate because the coroutines cant be used in static methods, so if you need to use the changeSceneWithAnimation method you have to have an instance of the class. It also has the public static method changeScene that allow change the active scene to other but without any transition.
◆ Awake()
void ChangeScene.Awake |
( |
| ) |
|
|
private |
This method is called just before the first frame. It search for other sceneManager objects and if there is other one, it will destroy this instance. It also hide the text that will be showed during the fade in animation.
◆ changeScene()
static void ChangeScene.changeScene |
( |
string |
sceneName | ) |
|
|
static |
This method tries to load the scene that have the given name, if there isnt any scene with the given name it will produce an exception.
- Parameters
-
string | that contains the name of the scene that it will change. |
◆ changeSceneWithAnimation()
void ChangeScene.changeSceneWithAnimation |
( |
string |
sceneName, |
|
|
float |
transitionTime = 1f , |
|
|
string |
text = "Loading..." |
|
) |
| |
this method starts a coroutine that execute the makeFadeInFadeOutAnimation method.
- Parameters
-
string | the name of the scene to change |
float | the duration time of the transition in seconds |
string | the text that will be showed during the transition |
◆ makeFadeInFadeOutAnimation()
IEnumerator ChangeScene.makeFadeInFadeOutAnimation |
( |
string |
sceneName, |
|
|
float |
transitionTime, |
|
|
string |
text = "Loading..." |
|
) |
| |
|
private |
this coroutine shows the given text, makes a fade in animation, change the scene, and then it does a fade out animation to hide both the text and the black image. All the process takes the given number of seconds.
- Parameters
-
string | the name of the scene to change |
float | the duration time of the transition in seconds |
string | the text that will be showed during the transition |
◆ text_
GameObject ChangeScene.text_ |
|
private |
this SerializeField GameObject contains a GameObject with the text that will be showed during the fade in animation.
◆ transition_
Animator ChangeScene.transition_ |
|
private |
this SerializeField Animator contains a reference to an Animator object that has the fade in and fade out animations
The documentation for this class was generated from the following file: