- Home /
Adding A Script To A Scene
Hello I recently created the script below.
function Update(){
if(Input.touchCount > 1){
Application.LoadLevel("1");
}
}
My question is how would I attach this to an object or anything to make the scene change. I don't really care what I have to touch to advance to the next scene ( The game is still in very early stages and I just want some basic scenes to be able to switch). Thanks a ton in advance any help would be greatly appreciated.
Answer by Kiwasi · Jul 03, 2014 at 12:26 AM
Anything that inherits from MonoBehavior (or relies on Update being called by unity) must be attached to a GameObject to function. Try attach it to an empty GameObject in your scene and see if it works.
Answer by pumpkinszwan · Jul 03, 2014 at 12:27 AM
Just drag the script onto a gameobject in your scene. As long as your script is the (default) MonoBehaviour type if will work.
Your answer
Follow this Question
Related Questions
Assign Default For Large Array 1 Answer
How i make this code in Unity Javascript 2 Answers
problem at adding script 1 Answer
Can someone help me fix my Javascript for Flickering Light? 6 Answers
Moving on Axis 1 Answer