- Home /
Load Scene Moving Too Fast(C#)
Hi Guys, I have a script from a app for when i touch the screen it goes to another scene but it doesn't stay on that scene it quickly moves to the next scene. Is there something wrong with my script. Thank You
First Scene
using UnityEngine;
using System.Collections;
public class MenuToLevelSelect : MonoBehaviour {
void Start ()
{
}
// Update is called once per fram
void Update() {
if (Input.touchCount == 1) {
// Do something
Application.LoadLevel ("Level Select");
}
}
}
Scene i want to stay on
using UnityEngine; using System.Collections;
public class LevelSelectToLevel : MonoBehaviour {
void Start ()
{
}
// Update is called once per frame
void Update ()
{
if (Input.touchCount >= 1)
{
Application.LoadLevel("1");
}
}
}
You probably want to make a button that you need to press. The touchCount may be over or equals to one as soon as you reach the scene you want to stay on
Also, cehck out TouchPhases. You can check for when the touch ahs ended before you actually load the scene.
If(Input.TouchCount == 1 && TouchPhase.Ended)
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Lighting looks really weird in 2D game 1 Answer
How to make character move up walls and along the ceiling? 0 Answers
2D Platformer moving platform help C# 3 Answers
Distribute terrain in zones 3 Answers