- Home /
UI cycling through my level select levels
When I run my unity 5 game, it quickly cycles through all of my levels, then stops on my last level. My script for starting the levels is:
 using UnityEngine;
 using System.Collections;
 using UnityEngine.SceneManagement;
 
 public class Normal : MonoBehaviour {
 
     public void Start()
     {
         OnClick();
     }
 
     void OnClick()
     {
         SceneManager.LoadScene(1);
     }
 }
I didn't change anything from the basic UI menu that Unity has provided (I guess I did though, on accident). Here is the stuff that is attached to my UI buttons:  I do think there is an easier way to do this that works. I can clarify if needed. Thanks.
 I do think there is an easier way to do this that works. I can clarify if needed. Thanks.
Answer by Naphier · May 12, 2016 at 07:21 AM
"Start" method runs as soon as a level is loaded. Remove the Start method or just the call to OnClick() in the Start method. Make OnClick() a public method and call that from the Button component's On Click event.
Your answer
 
 
             Follow this Question
Related Questions
Problem to go to another world scene in level select lock/unlock 0 Answers
I can't click to an UI button. 3 Answers
How do I switch scenes by obtain a children ui canvas text 0 Answers
Text Background 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                