- Home /
The question is answered, right answer was accepted
Moving to next scene takes large time to load
I am using a drop down in my every scene .By which i can select scene and go to that..But swapping between scenes take large time to load..Code i am using to change scene is given below
public class Loadscene : MonoBehaviour
{
public Dropdown dropdown;
void Update()
{
//Add listener for when the value of the Dropdown changes, to take action
dropdown.onValueChanged.AddListener(delegate
{
DropdownValueChanged(dropdown);
});
}
void DropdownValueChanged(Dropdown change)
{
SceneManager.LoadScene(change.value);
}
}
How will the loading speed be increased?
Answer by ShadyProductions · Feb 04, 2020 at 11:55 AM
Update runs every FRAME, you don't want to add an event listener every frame. Once is enough.
void Start()
{
//Add listener for when the value of the Dropdown changes, to take action
dropdown.onValueChanged.AddListener(delegate
{
DropdownValueChanged(dropdown);
});
}
Remove update method.
Follow this Question
Related Questions
how to save scene when switch another scene? 2 Answers
Attempting to Create an Essential SceneElements Checker 0 Answers
CheckConsistency: GameObject does not reference component Animator. Fixing. 0 Answers
Variables are resetting after loading the play scene 1 Answer
How to keep the same gameobject with different transform values in different scenes 1 Answer