Hey i just finished an android app. I unchecked development build to build it without the text in the bottom. But once I touch the screen, it just crashes. It works perfectly when development build is checked. Why would that change anything?
development builds run slower, perhaps you have something that only works cause the slower happily makes it go through without hitting a null ref exception due to something not initialized yet.
The two most common places that cause that are code that in awake tries to use other objects in the scene → big no go (don’t do that before start) or using OnLevelWasLoaded to find anything, cause onlevelwasloaded runs with / before awake even so its granted to cause null ref exceptions
hmm interesting. Well it runs, until i hit GUI buttons. Any of them make it crash. is there something with the GUI you have to change?
Please, if possible, report this bug (Unity → Help → Report a Bug) and attach your repro project. Thanks!
Sometime, especially when a gui.button leads to an Application.LoadLevel instruction, needs a boolean flag somewhere, to avoid that the code part where the Load is executed is not reached twice !
This is not the case if you have something like:
if(GUI.button(...){
Application.LoadLevel
}
But could happens if the EG: the GUI.button sets a flag that make your engine load the level NEXT loop.
Sometime the coder could forget to make this flag back FALSE after the LoadLevel instruction.
This happened in the release version of our App once, so we realized our bug, and fixed it.
But in the debug version the crash never happened. (Was iOS though, but the engine still Unity so…it may be a similiar problem)
actually it turned out to be because of Gameobject.Find. I just declared it earlier and it worked
I’m having exactly the same problem. Everything works great on the dev build, but the final build crashes as soon as I hit a GUI button to load the next level. I’ll look through and see if I have a FIND or if I’ve got a boolean set to true.
I have seen this time after time with unity 3D.
First time I did report this problem, but there was no solution from them.
But I did find a solution. I did buy Playmaker and used that GUI system and the problem did go away.
But I seen it later on to, but it was a version on unity 3D that did not work.
Now it has worked fine, but I always use Playmaker for the GUI stuff.
Here it is in it’s absolute simplest form, 2 scenes, one calls the other, and I still get a crash…Fatal signal 11
firstWindow has the following script attached to the main camera
function OnGUI () {
if (GUI.Button( Rect( Screen.width/2+90, Screen.height/2+30, 150, 50), "Second Window")){
Application.LoadLevel("secondWindow"); // load the game level.
}
}
secondWindow has the following script attached to the main camera
function OnGUI () {
if (GUI.Button( Rect( Screen.width/2+90, Screen.height/2+30, 150, 50), "First Window")){
Application.LoadLevel("firstWindow"); // load the game level.
}
}
and the result is a crash. unity 3.5.6f4 is broken! Or my Galaxy Tab 2 is…one or the other.
Make a new project and this time do NOT use the development mode.
Make those 2 scene and try it out.
As I sad before, the GUI stuff in unity is a bit buggy and if you use other system it will work better.
Also those is often more optimized and smoother.
I doubt its a GUI problem. When this happened to me it was because of a null reference.
I also have it in some builds of unity 3D. But as a told before it was fixed with Playmakers GUI system.
I did try a new project. Also updated all things I could, even re-installed unity3D and androidsdk. Same issues.
But I also did see that if I made a project without compiling it in developer mode it worked, but as soon I used developer mode it did break.
I did also send a bug report of this.
There is about 6 lines of code in the example I gave and no opportunity for a null reference. The only thing in the example is an if statement and GUI calls. It must be the GUI. I’ll look up the Playmakers GUI system and see if that helps me too. It would suck to have to always use non-dev build.
I don’t understand why every android developer is not running into this problem. It doesn’t make any sense.
Don’t worry. Many android developer here don’t know much how to solve problem. They will tell you there is zero problem and you is the problem. Like I did say playmaker has solved this issues more then one time for me. Now I always use playmaker if I use any GUI stuff.
Downgrading to Unity 3.5.2 fixes this issue.