Scene not loading in game tab but works when built??
My function to change sense only works in built .exe files and not in the game tab. I can't figure out why this would be as the "printDebug.Log("loading level: " + name );" line works and the function works when it's called with a button click. Any help would be greatly appreciated. The scripts are below if that helps :/
Load level script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LevelManager : MonoBehaviour {
public void LoadLevel(string name)
{
Debug.Log("loading level: " + name );
Application.LoadLevel(name);
}
public void QuitRequest()
{
Debug.Log("Quiting");
Application.Quit();
}
}
Script it's used in:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LoseCollider : MonoBehaviour
{
public LevelManager levelManager;
void OnTriggerEnter2D(Collider2D collision)
{
print("loading level");
levelManager.LoadLevel("Win");
}
}
Comment
Your answer
Follow this Question
Related Questions
Camera Preview is empty 5 Answers
EditorGUILayout.ObjectField and array 0 Answers
Why does UnityAds crash my game after I close the ad? 0 Answers
editor script problem, looping 1 Answer
Gizmos and Handles 1 Answer