Quantcast
Channel: Questions in topic: "crash"
Viewing all articles
Browse latest Browse all 2383

Project crashes in stand alone but not in editor.

$
0
0
When I run the game in the editor the game runs fine. But when I build a stand alone version for windows the game crashes just after loading the first scene. My music plays sometimes but not always. Has any one else encountered this problem? I'm running windows 7 premium 64 bit and unity is currently version 4.3.4f1 I'm going to update to the newest version of unity but I dont have much hope that will fix it. EDIT: It was working fine. I made the following changes before it stopped working. 1 Added a company name to the build settings. It was two words with a space 2 checked the box to allow it to run in background EDIT2: Something else interesting to note. I created a completely empty scene and moved that scene above my main scene. The client does not crash with that scene. So it must be something in the scene. EDIT3: When the following script is removed the stand alone program runs fine. using UnityEngine; using System.Collections; using System.Collections.Generic; /// /// The purpose of this script is to display proper menus when a /// user is in the game but not currently playing cards. /// /// It will also need to move the camera around to different views. /// public class menuScript : MonoBehaviour { //vars start_____________________________ int userId = loginScript.userId; bool loggedIn = loginScript.loggedIn ; private bool ran = false ; //menu vars. private bool showMainMenu = false; private bool showDeckMenu = false ; private bool showBarMenu = false ; private bool showPlayMenu = false ; private bool buildingDeck = false ; private bool showMyDecks = false ; public static bool playing = false ; //These variables are used to define the main //window. private Rect connectionWindowRect; private int connectionWindowWidth = 400; private int connectionWindowHeight = 280; private int buttonHeight = 60; private int leftIndent; private int topIndent; private string titleMessage = "Tavern Trading Card Game" ; //vars for different transforms of camera locations. public Transform barCam ; public Transform deckCam ; public Transform startCam ; public Transform gameCam ; public Transform mainCam ; public Transform target ; private float cameraSpeed = .1f ; //to control the build deck background public GameObject buildDeckBackground ; //these vars are used to query a php page to see what decks a player has. public string url = "http://tavern.workingurl.net/workingpage.php"; public WWW www; public string response ; //public int[] myListedDecks ; //these vars are for the names of decks. public string getDecksUrl = "http://tavern.workingurl.net/workingpage.php"; private string deck1 ; private string deck2 ; private string deck3 ; private bool ran1 = false ; private bool ran2 = false ; private bool ran3 = false ; //these 3 vars will hold the id of the decks we have made. private string deck1Id ; private string deck2Id ; private string deck3Id ; //these vars will hold the id of each card that is currently in the deck. //we will start with 30 + up to 3 heroes. //these are auto populated based one what deck is selected. private int hero1; private int hero2; private int hero3; private int ab1 ; private int ab2 ; private int ab3 ; private int ab4 ; private int ab5 ; private int ab6 ; private int ab7 ; private int ab8 ; private int ab9 ; private int ab10; private int ab11; private int ab12; private int ab13; private int ab14; private int ab15; private int ab16; private int ab17; private int ab18; private int ab19; private int ab20; private int ab21; private int ab22; private int ab23; private int ab24; private int ab25; private int ab26; private int ab27; private int ab28; private int ab29; private int ab30; //bool to see if the get decks coroutine is already running private bool getDecksBusy = false ; private bool getDecksDone = false ; //vars end_______________________________ // Use this for initialization void Start () { target = mainCam; //Debug.Log("FIRSTUSERID:"+userId); } // Update is called once per frame void Update () { int userId = loginScript.userId ; bool loggedIn = loginScript.loggedIn ; if (loggedIn == false){ Application.Quit(); } //Debug.Log ("ran"); if (loggedIn == true) { if (showBarMenu == false && showDeckMenu == false && showPlayMenu == false && playing == false && buildingDeck == false ){ showMainMenu = true ; } } float step = cameraSpeed * Time.deltaTime; Camera.main.transform.position = Vector3.MoveTowards (target.transform.position, target.position, step); //TODO: camera does not move smoothly. //rotate camera to be the same rotation as targetCam mainCam.transform.rotation = target.transform.rotation ; } void ConnectWindow(int windowID) { //Leave a gap from the header. GUILayout.Space(15); if(GUILayout.Button("Play", GUILayout.Height(buttonHeight))) { //StartCoroutine(WaitForThisDownload()); //hitting play needs to cause the camera to move to the table target = gameCam ; showPlayMenu = true ; showMainMenu = false ; } GUILayout.Space(10); if(GUILayout.Button("My Collection", GUILayout.Height(buttonHeight))) { //StartCoroutine(WaitForThisDownload()); target = deckCam ; buildingDeck = true ; showMainMenu = false ; //cause the background to be rendered. buildDeckBackground = GameObject.FindGameObjectWithTag("deckMenu"); //buildDeckBackground.renderer.enabled = true; //Cause a menu to appear on the left with our decks. showMyDecks = true ; } GUILayout.Space(10); if(GUILayout.Button("Store", GUILayout.Height(buttonHeight))) { //StartCoroutine(WaitForThisDownload()); target = barCam ; showBarMenu = true ; showMainMenu = false ; } GUILayout.Space(10); if(Application.isWebPlayer == false) { if(GUILayout.Button("Exit Tavern", GUILayout.Height(buttonHeight))) { Application.Quit(); } } } void myDecks(int windowID) { //Leave a gap from the header. GUILayout.Space(15); if (GUILayout.Button ("Deck 1", GUILayout.Height (buttonHeight))) { //Edit deck one //we need to look at the deck1 variable if its "Make a deck" then we need to //qry a php page and create a deck for them. //if its anything else we need to qry php to see what cards are in this deck. } GUILayout.Space(10); if(GUILayout.Button("Deck 2", GUILayout.Height(buttonHeight))) { // edit deck two } GUILayout.Space(10); if(GUILayout.Button("Deck 3", GUILayout.Height(buttonHeight))) { //edit deck 3 } GUILayout.Space(10); if(Application.isWebPlayer == false) { if(GUILayout.Button("Back", GUILayout.Height(buttonHeight))) { target = startCam ; showPlayMenu = false ; showMyDecks = false ; buildingDeck = false ; buildDeckBackground.renderer.enabled = false; } } } void playWindow(int windowID) { //Leave a gap from the header. GUILayout.Space(15); if(GUILayout.Button("Practice", GUILayout.Height(buttonHeight))) { //Play against AI } GUILayout.Space(10); if(GUILayout.Button("Online", GUILayout.Height(buttonHeight))) { //find a partner } GUILayout.Space(10); if(Application.isWebPlayer == false) { if(GUILayout.Button("Back", GUILayout.Height(buttonHeight))) { target = startCam ; showPlayMenu = false ; } } } void collectionWindow(int windowID) { //Leave a gap from the header. GUILayout.Space(15); if(GUILayout.Button("My Decks", GUILayout.Height(buttonHeight))) { //Play against AI } GUILayout.Space(10); if(GUILayout.Button("My Decks", GUILayout.Height(buttonHeight))) { //build a new deck here //we need to turn off this menu and run the build deck script } GUILayout.Space(10); if(Application.isWebPlayer == false) { if(GUILayout.Button("Back", GUILayout.Height(buttonHeight))) { target = startCam ; showDeckMenu = false ; } } } void storeWindow(int windowID) { //Leave a gap from the header. GUILayout.Space(15); GUILayout.Label ("The bar is currently closed."); GUILayout.Space(10); if(Application.isWebPlayer == false) { if(GUILayout.Button("Back", GUILayout.Height(buttonHeight))) { target = startCam ; showBarMenu = false ; } } } public IEnumerator makeADeck(){ WWW www = new WWW ("http://tavern.workingurl.net/workingpage.php"); WWWForm form = new WWWForm (); int userId = loginScript.userId ; form.AddField ("userId", userId); yield return www ; response = www.text; //for this response we are looking for an *ok* or a *fail* if (response == "*ok") { showMyDecks = false ; showMyDecks = true ; showMainMenu = false ; //here we need to bring up a show card menu. that shows what cards are currently in this deck. //TODO: make show card menu } } public IEnumerator getDecks(){ getDecksBusy = true ; bool deck1ran = false; ran1 = true; if (deck1ran == false) { int userId = loginScript.userId ; Debug.Log(deck1ran); WWWForm form = new WWWForm (); Debug.Log("USERID:" + userId); Application.Quit(); int user = loginScript.userId ; form.AddField ("userId", user); WWW www = new WWW (url, form); yield return www; response = www.text; //this now responds with a csv //that includes each decks name then id then name then id //we need to convert this csv into an array. //add a value to the other decks to ensure the array is full up to that point //okay so it seems we need two lists here. //c# is fucking retarded we cant count the number of values in a built-in array //because we are expected to know the number if values in a built in array. //so lets try using TWO lists. Debug.Log("Response:"+response); string[] lists = response.Split(':'); //lists[0] should have all the names //lists[1] should have all the id's List deckNames = new List(); List deckIds = new List(); string[] names = lists[0].Split(','); string[] ids = lists[1].Split(','); foreach (string value in ids){ Debug.Log(value); } foreach (string value in names){ deckNames.Add(value); } foreach (string value in ids){ deckIds.Add(value); } //now that we have somehow managed to get everything into a list //lets ensure all of the array keys we are attempting to call //are at least filled with something. deckNames.Add ("0"); deckIds.Add("0"); deckNames.Add ("0"); deckIds.Add("0"); deckNames.Add ("0"); deckIds.Add("0"); deck1 = deckNames[0]; deck1Id = deckIds[0]; deck2 = deckNames[1]; deck2Id = deckIds[1]; deck3 = deckNames[2]; deck3Id = deckIds[2] ; //all deck vars should be full now. //they are not full if the player hasn't made three decks! yield return new WaitForSeconds(1.0f); getDecksBusy = false ; } } void OnGUI () { if(showMyDecks == true) { if (getDecksBusy == false && getDecksDone == false){ StartCoroutine("getDecks"); getDecksDone = true ; } //Determine the position of the window based on the width and //height of the screen. The window will be placed in the middle //of the screen. leftIndent = 10; topIndent = Screen.height / 2 - connectionWindowHeight / 2; connectionWindowRect = new Rect(leftIndent, topIndent, 200, connectionWindowHeight); connectionWindowRect = GUILayout.Window(1, connectionWindowRect, myDecks, titleMessage); } if(showPlayMenu == true) { //Determine the position of the window based on the width and //height of the screen. The window will be placed in the middle //of the screen. leftIndent = Screen.width / 2 - connectionWindowWidth / 2; topIndent = Screen.height / 2 - connectionWindowHeight / 2; connectionWindowRect = new Rect(leftIndent, topIndent, connectionWindowWidth, connectionWindowHeight); connectionWindowRect = GUILayout.Window(1, connectionWindowRect, playWindow, titleMessage); } if(showBarMenu == true) { //Determine the position of the window based on the width and //height of the screen. The window will be placed in the middle //of the screen. leftIndent = Screen.width / 2 - connectionWindowWidth / 2; topIndent = Screen.height / 2 - connectionWindowHeight / 2; connectionWindowRect = new Rect(leftIndent, topIndent, connectionWindowWidth, connectionWindowHeight); connectionWindowRect = GUILayout.Window(1, connectionWindowRect, storeWindow, titleMessage); } if(showDeckMenu == true) { //Determine the position of the window based on the width and //height of the screen. The window will be placed in the middle //of the screen. leftIndent = Screen.width / 2 - connectionWindowWidth / 2; topIndent = Screen.height / 2 - connectionWindowHeight / 2; connectionWindowRect = new Rect(leftIndent, topIndent, connectionWindowWidth, connectionWindowHeight); connectionWindowRect = GUILayout.Window(1, connectionWindowRect, collectionWindow, titleMessage); } if(showMainMenu == true) { //Determine the position of the window based on the width and //height of the screen. The window will be placed in the middle //of the screen. leftIndent = Screen.width / 2 - connectionWindowWidth / 2; topIndent = Screen.height / 2 - connectionWindowHeight / 2; connectionWindowRect = new Rect(leftIndent, topIndent, connectionWindowWidth, connectionWindowHeight); connectionWindowRect = GUILayout.Window(0, connectionWindowRect, ConnectWindow, titleMessage); } } } What is in there that causes a crash? I seem to remove each item individually and it runs fine. But when the whole script is run together... it crashes.

Viewing all articles
Browse latest Browse all 2383

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>