Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed Feb 21, 2015 at 01:10 PM by meat5000 for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by assassins-badjas · Feb 19, 2015 at 05:44 AM · c#editorcrashstandalone

crash in standalone app not in editor

hey there, i've been making a game and it's almost finished. so i added a main menu and if i compile it into a standalone app (to test out the quit button) the app says powered by unity and then there's a black screen and then it crashes. this happens on mac and windows.

here is the start script that loads the level when pressed the start button

using UnityEngine; using System.Collections;

     public class Start: MonoBehaviour {
         public void LoadLevel(int Index = 1)
         {
         Application.LoadLevel(Index = 1);
         }
 }
  

and here's the quit script that quits the application when th quit button is pressed. using UnityEngine; using System.Collections;

 public class Quit : MonoBehaviour {
 
     public void ExitApplication()
     {
         ExitApplication();
     }
 }

i've tried application.quit but that gives the same result..... a crash

so this works in the editor but as a standalone application it crashes.

edit: i changed the start code it's this now and it still crashes

     using UnityEngine;
     using System.Collections;
     
     public class Start: MonoBehaviour {
     public void NextLevelButton()
         {
         Application.LoadLevel("game");
         }
 }
  

Comment
Add comment · Show 6
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image meat5000 ♦ · Feb 18, 2015 at 11:54 PM 0
Share

Take out the =1 from your LoadLevel function arguments. On that note, call it something different altogether. Perhaps its getting confused.

avatar image assassins-badjas · Feb 19, 2015 at 10:56 AM 0
Share

so use string ins$$anonymous$$d of index?

avatar image fafase · Feb 19, 2015 at 11:23 AM 0
Share

Are you sure it works in editor? The editor mode tends to "bypass" error, I mean it prints them on console and then manages to continue if possible. In build, a null ref tends to break the app no matter what. So check your console.

As for the method itself, the parameter is one by default and turned to 1 if else, so, kinda confusing what is happening.

avatar image instruct9r · Feb 19, 2015 at 11:28 AM 0
Share

Why are you using Index = 1? If you want to load level 1, just type:

Application.LoadLevel(1); or Application.LoadLevel("LevelName");

If the application is craching, then you most likely get an error in the editor...

avatar image assassins-badjas · Feb 19, 2015 at 11:51 AM 0
Share

i used the string kind but that didn't work because it said level -1 wasn't added to the build

Show more comments

1 Reply

  • Sort: 
avatar image
0
Best Answer

Answer by assassins-badjas · Feb 21, 2015 at 01:10 PM

okay so i fixed it by giving the uibutton sprites a material. it loads a bit slow but it works. i'm not sure why i had to give them materials tough.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Initialising List array for use in a custom Editor 1 Answer

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

How to fix losing System.Data.dll in Project? 2 Answers

Editing Animations crashes Unity 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges