Hi, i’m new to Unity and im working on a menu for a 2D game, nothing crazy.
The problem i have i dont know if it’s related to the script im using or something im missing on Unity it self
I have a button in the menu to start playing and the script attached to it as On Click is this
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class MenuStart : MonoBehaviour
{
public void Start()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
}
}
The thing is that when i run it, it just jumps to the next scene, without me pressing the “start” button
I have also tried an even more simplier code
using UnityEngine;
using UnityEngine.SceneManagement;
public class Control : MonoBehaviour
{
public void NextScene()
{
SceneManager.LoadScene("1");
}
}
But it has the same problem.
Im kinda lost with this, i dont know what could be the problem.
Thanks in advance.