how to attach scripts in unity for going to next level
i create a game in unity 5 when i click play button its doesn't work so . there is no error i am use c# code
using UnityEngine; using System.Collections;
public class PlayMenu : MonoBehaviour {
void onMouseDown(){
Application.LoadLevel ("Level1");
}
}
Can you go into a little more detail please? You load a first scene, and the UI appears and the Play button inside your UI doesn't load a level? Does it do anything? Try adding a Debug.Log("something")
Or are you clicking play in the editor and nothing happens?
Answer by Mikozouzou · Sep 09, 2015 at 01:01 PM
Do not forget to write OnMouseDown(), and not onMouseDown() !
You have to attach your script to the GameObject you click on as you're using OnMouseDown().
For example, if you but this script to a Cube you've just created it will trigger the function.
Answer by malialis · Sep 09, 2015 at 01:38 PM
Hello.
Make sure you are also adding "Level1" to the build menu. Otherwise it will not be able to load the level. Even if the level is in your assets folder, it needs to be in the Build Menu as well.
http://docs.unity3d.com/Manual/PublishingBuilds.html
Hope this helps.
Your answer
Follow this Question
Related Questions
NGUI - OnPress Trigger is not working in IOS Devices 1 Answer
Colliding doesnt work 1 Answer
how to get mono develop working? 0 Answers
Mac Unity won't run, no error message 0 Answers