I feel like i am missing something with my coding;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class LoadSceneOnClick : MonoBehaviour {
// Use this for initialization
public void LoadByIndex(int sceneIndex)
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
}
}
Even after I drag and drop the coding to the On Click section of my start button, and change it to run time, the button that says No Function gives no LoadIndex option like the tutorials I have scene. Is it something wrong with my coding or is the problem elsewhere?
Well that was odd, just reattached it and fixed that problem, however when i click the start button it still doesn’t load the indexed scene 1. Anything I could be missing or forgot in the code above?
It doesn’t register that I am hovering over the button either…
Your code looks…odd. You take a parameter called sceneIndex which is fine but then you use LoadScene with the index of the currently loaded scene completely nullifying the point of being able to supply your own scene index.
Change:
Odd, I swear thats what i originally had in it and it wouldn’t work but I will do as you say and see if I was just messing up and sorry, I forgot how to do them until last night.
Hmm…even after changing the setting to make the button blue when the mouse hovers over it, it doesn’t change, so I don’t seem to actually be interacting with the button at all. Any clue why this could be?
Actually i am going to rebuild this part completely.