Log in or register to post comments

Re-loading Scene On Phone

April 20, 2011 - 2:48pm #1

I am using a Motorola Droid 2 to run an AR app created using the Unity plugins. We are experiencing the following technical difficulties:

1. When we beat our level, the game returns the player to the main menu. When the player attempts to restart the game, Application.LoadLevel(1) is called and the level loads but the AR features do not work. Specifically, the first image the camera sees is captured and remains on the screen, while the creatures move and the camera stays frozen in its initial position.

2. 4/23 - Crashing problem mostly fixed. Game crashes after TrackScript:OnDisable() is called.
4/21 - The game often crashes upon picking up the trackable and sometimes it crashes immediately after loading the game.

3. On other occasions the screen appears mostly black, as though a piece of paper were in front of the screen and only a small row at the top is actually visible.

4. On occasion, this error occurs: Sorry! The application Feast(process com.qualcomm.QCARUnityPlayer) has stopped unexpectedly. Please try again. I've got the patch in already so I'm not sure what's the problem.

Our team is working on gathering pictures of the bugs we are encountering and actively seeking solutions. Any help would be greatly appreciated with any of these errors.

The attached image shows problem 1 and problem 3 respectively.

Re: Re-loading Scene On Phone

April 13, 2012 - 3:14pm #23

Thanks for following up. We'll investigate further and fix this if necessary for a future release.

- Kim

Re: Re-loading Scene On Phone

April 13, 2012 - 12:00pm #22

I was able to fix the issue by re-creating the EAGLSurface when Unity is un-paused. Here's my new applicationDidBecomeActive method in AppController.mm:

- (void) applicationDidBecomeActive:(UIApplication*)application
{
	printf_console("-> applicationDidBecomeActive()\n");
	if (_didResignActive)
	{
        // Recreate the Unity surface -- this fixes an issue that would sometimes cause Unity to freeze when unpausing it
        DestroySurface(&_surface);
        EAGLView* view = (EAGLView*)[sGLViewController view];
        CreateSurface(view, &_surface);
        
        // seems like ios sometimes got confused about abrupt swap chain destroy
        // draw 2 times to fill both buffers
        // present only once to make sure correct image goes to CA
        _skipPresent = true;
        {
            UnityPlayerLoop();
            UnityPlayerLoop();
            UnityFinishRendering();
        }
        _skipPresent = false;
        
        PresentSurface(&_surface);
        // End recreate the Unity surface
        
        
        EAGLContext *oldContext = [EAGLContext currentContext];
        if (oldContext != _context)
        {
            [EAGLContext setCurrentContext:_context];
        }
		QCARUnityPlayer::getInstance().QCARPause(false);
		UnityPause(false);
	}

	_didResignActive = NO;
}

Re: Re-loading Scene On Phone

April 13, 2012 - 9:49am #21

It appears that the LoadLevel is a red herring. I removed all level reloading and the issue still occurs. I'm pausing and un-pausing Unity using "applicationWillResignActive" and "applicationDidBecomeActive", and swapping between Unity's viewController and my own viewController by changing the "rootViewController" on the window. This works for 3 or four times, but eventually, on one of the returns to Unity's view controller, Unity appears frozen, even though in the background I see messages coming from Unity in the console.

Re: Re-loading Scene On Phone

April 11, 2012 - 9:50pm #20

We haven't seen this lately. Are you running one of the samples (which one)? We'll try to reproduce on our end.

How are you reloading the scene, by pausing/resuming the app or by using the Application.LoadLevel method?

Thanks,

- Kim

Re: Re-loading Scene On Phone

April 11, 2012 - 3:36pm #19
Nychii wrote:

3. On other occasions the screen appears mostly black, as though a piece of paper were in front of the screen and only a small row at the top is actually visible.

I'm experiencing a similar problem on iOS (iPad with iOS 5.1, Vuforia 1.5.8, and Unity Pro 3.5.0f5). If I reload a QCAR scene, sometimes the background video texture is rendered, but sometimes it is just rendering a black screen. The tracker is still running and accessing the camera, as I can see output in the debug console regarding trackables being found and lost.

Are there any known workarounds to fix this?

Re: Re-loading Scene On Phone

June 15, 2011 - 1:32am #18

Thank you for your reply. Produced 3 separate demos instead but good to know how to fix it in future though.

Re: Re-loading Scene On Phone

June 14, 2011 - 3:18pm #17

There are a few factors at play here:

1) The config.xml file is shared across scenes. Any buttons in one scene will also belong to the same image targets in another scene. Choose your targets and buttons wisely to work across multiple scenes. Or, try dynamically creating your buttons during runtime, rather than adding them in the Unity editor (this bypasses the config.xml file constraint). See the following section off the ar main page (http://ar.qualcomm.com):

Getting Started - Unity Extension > Step 3 : Mastering Advanced Topics > Using Virtual Buttons > Creating and deleting Virtual Buttons at run-time

2) There is a known bug when switching scenes containing virtual buttons. It will be fixed in the next release, but for now you can simply comment out the OnDestroy method in VirtualButtonBehaviour.cs to fix it. Note this bug only affects buttons created in the editor (and hence in the config.xml file). If you create your buttons at run time you won't see the issue.

- Kim

Re: Re-loading Scene On Phone

June 14, 2011 - 3:26am #16

Thanks for your reply. That didn't fix it but my investigations seem to be pointing at Virtual Buttons.

When I load a level that has virtual buttons it seems fine. I go back to the main menu and return to the same level the log files show repeated

Virtual button sensitivity could not be set

messages.

then when I quit back to the main menu the app crashes

edit: I dont know if this is related but sometimes in the editor in one scene my image target suddenly has the buttons from the other scene as children in addition to the ones it should have. I delete them but sometimes they come back seemingly at random.

edit 2: As a matter of interest I i made a fresh project with a simple main menu and imported the football virtual button demo and load/reload it and the same error occurs resulting in a crash the second time you quit back to the menu scene.

Re: Re-loading Scene On Phone

June 13, 2011 - 5:48pm #15

Hello,

Try modifying the TrackerBehavior.cs script to completely de-init and re-init the camera. In the onEnable and onDisable methods try adding:

    void OnEnable()
    {
        if (mHasStartedOnce)
        {
        	cameraDeviceInitCamera();
        	ConfigureVideoBackground();
        	cameraDeviceSelectVideoMode((int) CameraDeviceModeSetting);
        	cameraDeviceStartCamera();
        	startTracker();
        }
    }

    void OnDisable()
    {
        stopTracker();
        cameraDeviceStopCamera();
        ResetCameraClearFlags();
        cameraDeviceDeinitCamera();
    }

Let me know if that solves your problem.

-Peter

Re: Re-loading Scene On Phone

June 13, 2011 - 5:45am #14

I've just encountered this problem.

When my main menu has an ARCamera, I load a new scene that also contains one. Then quit back to the main menu and my application crashes back to desktop.

Works fine in the unity player but not on my HTC desire (Android 2.2)

Re: Re-loading Scene On Phone

April 27, 2011 - 1:59pm #13

Try upgrading to the new 1.0.0 release, hopefully that will resolve some of these issues.

- Kim

Re: Re-loading Scene On Phone

April 27, 2011 - 1:47pm #12

Funny, when I used the back button to return to menu on the Nexus One, it crashed.
Out of curiosity, what does the OnDisable() do? It's always called when it's crashing...

Re: Re-loading Scene On Phone

April 25, 2011 - 12:34pm #11

It seems problem #1 is a device specific issue that I've only seen on my Droid X. When I tried the exact same project on a Nexus One, it worked fine.

Re: Re-loading Scene On Phone

April 22, 2011 - 10:59am #10

I've sent mine over as well. I believe I know why the game is crashing and I believe it's related to our code which might fix problem #2 and possibly #4 but I'm still not certain about problems #1 and #3.

Re: Re-loading Scene On Phone

April 22, 2011 - 9:29am #9

I just sent off my test project to you via your me2u service. Let me know if you need anything else from me.

Re: Re-loading Scene On Phone

April 22, 2011 - 7:27am #8

It would be helpful to have access to the whole project, I'm going to try adding a few new things to see if we can fix the issue. Dropbox access is fine, or you can zip up the project and send it using our me2u service (just create an account with your email address): http://me2u.qualcomm.com

Send to

if using me2u.

Thanks!

- Kim

Re: Re-loading Scene On Phone

April 22, 2011 - 7:16am #7

Unfortunately, we have not tested it on any other phones but I've got a friend with the Nexus One that I ask to try on his device sometime this weekend. Also, my college (RPI) was in contact with your company about your development phones but apparently we've lost contact with you after the initial weeks. I've had some help from Paulius on allowing us to test the game in Unity during GDC and it currently runs just fine in Unity.

I can provide you with the files but the whole file is quite large. Do you just want a version of the apk or just be linked to the dropbox?

Re: Re-loading Scene On Phone

April 22, 2011 - 7:08am #6

Sure, I'll put together a small test application and send it to you. I'm testing on a Droid X.

Re: Re-loading Scene On Phone

April 22, 2011 - 6:27am #5

Hi guys,

Sorry for the late response. We're working hard on some fixes right now, hopefully we'll have something to you soonish. In the meanwhile, would it be possible to share your app (or a stripped-down version) that displays the problems? I'd be happy to do some testing on our end, with some of our fixes in place, to see if it helps.

If so, please send the projects to

.

Also, Sentinel, what device are you using for testing? The Droid 2 is a bit of a troublesome device for us... Nychii, have you tried your game on any other devices?

Thanks!

- Kim

Re: Re-loading Scene On Phone

April 22, 2011 - 6:08am #4

We're still trying to figure out our crash problems since they're higher on our priority list, we can't play the game majority of the time because it keeps crashing. Is there an easier way to debug on the phone?

Re: Re-loading Scene On Phone

April 21, 2011 - 9:21pm #3

Has anyone else seen the issue where changing the scene, using Application.LoadLevel("Name") makes the camera feed lock up in the next AR scene?

I've been banging my head against it for a few days now and I've had no luck so far.

Re: Re-loading Scene On Phone

April 20, 2011 - 10:19pm #2

I'm actually having the same issue as #1. I'm still looking into possible solutions, but haven't found anything so far.

Log in or register to post comments