- Home /
UI 4.6 menu "Start" button script c#
Hello,
i followed a video to build an UI. Now i want to make that the "Start" button loads my Level. The Level is already in the Build-Settings.
How could a new script look like? Is this useful?
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour {
void Example() {
Application.LoadLevel("HighScore");
}
}
It is easy and i tried the code, but if i attach the script to the UI button it always says: script can not be loaded....fix errors etc, but the console does not show any errors.
Comment
using UnityEngine;
using System.Collections;
public class Start_Level : $$anonymous$$onoBehaviour {
public void Test()
{
Debug.LogError("Button was pressed");
Application.LoadLevel ("level1");
}
}
Script attached at camera and now drag camera into new object field in "On Click()" and select "Test()".
I solved it by my own !:D