- Home /
Building my first 3D location-based game - A question about the "play" function
Hi guys,
I'm fairly new to Unity, and I have just created an extended version of the 3D Location-based game using Mapbox to become familiar with some of the basic features of Unity. I want to turn that into an application, by using "build", but when I build my application, I end up with "empty" screen with only the Playertarget in it. I only have one scene, and I thought that the initial scene would automatically run. I have tried to include an editor script, seen below, which didn't change anything. Furthermore, I tried to add a play button, with a loader script attached to it, but that didn't help either.
//Editor script:
using UnityEditor;
using UnityEngine;
using System.Collections;
[InitializeOnLoad]
public static class SimpleEditorUtils
{
// click command-0 to go to the prelaunch scene and then play
[MenuItem("Edit/Play-Unplay, But From Prelaunch Scene %0")]
public static void PlayFromPrelaunchScene()
{
if ( EditorApplication.isPlaying == true )
{
EditorApplication.isPlaying = false;
return;
}
EditorApplication.SaveCurrentSceneIfUserWantsTo();
EditorApplication.OpenScene(
"Assets/Scenes/SampleScene.unity");
EditorApplication.isPlaying = true;
}
}
// Loader Script
using UnityEngine;
using System.Collections;
public class Loader : MonoBehaviour {
public void Play(){
Application.LoadLevel(0);
}
}
I am almost sure I'm missing something completely basic, but I have tried to search the internet for serval hours, and without luck. I just want the "game" to run when I open the application.
Any help is highly appreciated.