Log in or register to post comments

Application.LoadLevel() from AR to Mainmenu crashes game

December 22, 2010 - 2:12am #1

I've made a menu prior to the AR scene, which loads first on startup.
The user taps 'play' and the AR scene loads just fine using Application.LoadLevel(1).

In the AR scene, I've created another 'in-game' menu, with an option to return to the main menu.
I'm currently using Application.LoadLevel(0), but that seems to make my game crash.

Any alternatives? Or thoughts why it would crash in the first place?

Re: Application.LoadLevel() from AR to Mainmenu crashes game

May 26, 2011 - 6:59am #15

Are you using version 1.0 of the QCAR Unity Extension? If so, could you possibly send a sample exhibiting this behavior to

?

Thanks,

- Kim

Re: Application.LoadLevel() from AR to Mainmenu crashes game

May 25, 2011 - 6:37am #14

I'm experiencing the same kind of problem. I go from the main menu to the game and back to the menu quite easily. But then, when I load my game scene for the second time, the virtual button in it doesn't respond anymore (the 3D models are displayed though). So how did you guys manage to get your app working after all?

Re: Application.LoadLevel() from AR to Mainmenu crashes game

January 7, 2011 - 1:29am #13

Works like a charm for me now!
I can open an ingame menu and restart the scene, load the mainmenu scene and exit the app without crashes.

Re: Application.LoadLevel() from AR to Mainmenu crashes game

January 6, 2011 - 1:08am #12

Hi,

my bad. It's working. we went over our code and discovered some issues when initializing data. So basically everything is fine now.

Thanks

Re: Application.LoadLevel() from AR to Mainmenu crashes game

January 4, 2011 - 12:56pm #11

Please do send a sample if possible. I've done some further testing, and with both a GUI button and the back button I can't reproduce a crash. I will say that sometimes the camera "stutters" when the AR scene is recreated, we are looking into this problem.

- Kim

Re: Application.LoadLevel() from AR to Mainmenu crashes game

January 4, 2011 - 10:11am #10

I commented the Marshal.FreeHGlobal(trackableData.virtualButtonsPtr) call in the TrackerScript.cs but still experience the problem. When I call Application.LoadLevel(...) the application crashes. The scenes are really simple, just primitive textured objects (cube, sphere) and some scripts. Nothing special.

I will try to send you an example project that illustrates the problem.

Re: Application.LoadLevel() from AR to Mainmenu crashes game

January 4, 2011 - 12:12am #9

Can't wait to try it out,
but unfortunately my Unity license I got for this project is expired.
So I cannot continue until I get that fixed first. >

Re: Application.LoadLevel() from AR to Mainmenu crashes game

January 2, 2011 - 11:30am #8
function OnGUI(){
	if (Input.GetKeyDown(KeyCode.Escape)){
		Application.LoadLevel ("MainMenu");
	}
}

That will make the hardware "back" button change scenes.

I'll try commenting out the code and let you know.

Thanks mates,
CapnJ

Re: Application.LoadLevel() from AR to Mainmenu crashes game

December 31, 2010 - 1:07pm #7

I finally made a sample with multiple scenes to test all this out. We found a bug in the TrackerScript that can cause a crash in some circumstances. You may need to comment out the following line in TrackerScript.cs if you are seeing a crash on scene change:

Marshal.FreeHGlobal(trackableData.virtualButtonsPtr);

I'm not sure why the camera isn't reinitializing in your case however. My test used a GUI button to back out to the main menu, how did you set up the back button to work? My test application doesn't respond to the back button at all...

As always, sample applications sent to

will result in the quickest bug fixes :) Although I won't be around tonight, Happy New Year everyone!

- Kim

Re: Application.LoadLevel() from AR to Mainmenu crashes game

December 31, 2010 - 11:31am #6

Havin' a similar issue, but no crash...

2 scenes:
1 Main menu - (no AR)
1 Game - (AR)

- On the main menu i click a button to start game, scene switches to "Game".
- Game loads and plays fine
- If you press the hardware back button, scene returns to main menu
- Click play button again and scene changes to "Game" BUT...
- The camera does not seem to reinitialize. All game elements are there, just no camera feed.

Any thoughts? Is there something i'm supposed to reset on scene load?:confused:

Yar,
CapnJ

Re: Application.LoadLevel() from AR to Mainmenu crashes game

December 23, 2010 - 7:56am #5

Could you possibly send a sample project to

? You can remove any game-specific items in the AR scene if you prefer, I would just like to test your scene transitions. There's probably an issue with the order of initialization, or with reinitialization of the ARCamera object.

- Kim

Re: Application.LoadLevel() from AR to Mainmenu crashes game

December 23, 2010 - 5:03am #4

I did some testing.
In my case it is possible to switch between two or more 'normal' scenes, but as soon as I put one in with the ARcamera prefab, it crashes without error when I try to load the new level.

Re: Application.LoadLevel() from AR to Mainmenu crashes game

December 22, 2010 - 2:32am #3

I just tried it on a Desire HD, and there it crashes as soon as I open the menu using one of the hardware keys, so I'm starting to suspect my menu instead of the Application.Loadlevel function.

Re: Application.LoadLevel() from AR to Mainmenu crashes game

December 22, 2010 - 2:30am #2

I can (re)load the same scene at least... so workaround I guess is to put everything into same scene if it actually doesn't work...

Log in or register to post comments