0

I am having a problem with the Game Center integration in MonoTouch, whereby the Game Center sign-in view is loading, but it is erasing any textures currently loaded. If I comment out the PresentModalViewController line, then the game center sign in form doens't appear, but the already-loaded textures stay in memory and work. I'm using the following code to display the game center view:

    GKLocalPlayer.LocalPlayer.AuthenticateHandler = (ui, ErrorCode) =>
        {
            if (ui != null) {
                Debug.WriteLine ("GK Not authenticated, presenting login");
                PresentModalViewController (ui, true);
            } else {
                Debug.WriteLine ("GK Checking Authentication");
                bool authenticated = GKLocalPlayer.LocalPlayer.Authenticated;

                if (authenticated)
                    Debug.WriteLine ("Game Center Authenticated. " + GKLocalPlayer.LocalPlayer.DisplayName);
                else
                    Debug.WriteLine ("Game Center Not Authenticated. " +  GKLocalPlayer.LocalPlayer.PlayerID + " " + ErrorCode.ToString());
            }
        };

Has anyone seen this issue before, and if so, what is the solution to display the game center sign in page, but keep the loaded textures?

madth3
  • 7,275
  • 12
  • 50
  • 74
emacinnes
  • 21
  • 2

1 Answers1

0

Found the answer to this one, and it was related to the MonoTouch OpenTK sample app recommending that the render buffer be destroyed in the ViewWillDisappear event, which occurs when the GameCentre window appears. When the Buffer is destroyed, the textures went with it, so the solution here is to not destroy the renderbuffer in the ViewWillDisappear event (and subsequently, don't recreate it in ViewWillAppear).

emacinnes
  • 21
  • 2