Search Unity

How to deal with putting a UIWindow on top of Unity's OpenGL

Discussion in 'iOS and tvOS' started by iCOOLgeeks, Aug 19, 2009.

  1. iCOOLgeeks

    iCOOLgeeks

    Joined:
    Mar 22, 2009
    Posts:
    65
    I’ve been struggling to get AdWhirl working right on my Unity built app. I think the problem boils down to the fact that Unity builds an OpenGLES project, while adwhirl relies on having a UIWindow.

    So, I’ve added a UIWindow to the build and create the ARRollerView as a subview of the window, then make the window.hidden = no; This gets the ad to show up fine with the following problems.
    • - If I create the UIWindow to be 320x480 it fills the whole screen and keeps me from being able to access the buttons and objects in the OpenGLES view below it. But the ad shows up fine, and if I click on the ad they work fine, but my app can’t work because of blocking the buttons.
    • - If I create the UIWindow to be 320x48 (so it's only the size of the ad), again the ad shows up fine, and the buttons on my OpenGLES view are accessible and work. But, if I tap the ad to open it, it crashes my app (because the ad tries to create an UIWebView within the app it crashes the app because the UIWindow is too small I think.)

    Does anyone know what I can do to keep it from crashing when it tries to create a UIWebView but the window is set to 320x48.
    Or maybe someone knows how to make the OpenGLES view accessible through a UIWindow of 320x480?
     
  2. bliprob

    bliprob

    Joined:
    May 13, 2007
    Posts:
    901
    You can totally create a smaller window over Unity's window; the EP does this all the time. Unless it's a crash from inside AdWhirl (have you checked your stack trace when you crash?) it's probably crashing for some other reason. Send me your AppController file and I'll give it a look. (Previously you sent only snippets, and I couldn't fully see what you were doing w/r/t to retain/release cycles, so please send the whole thing.)
     
  3. iCOOLgeeks

    iCOOLgeeks

    Joined:
    Mar 22, 2009
    Posts:
    65
    Here's my AppController.h .mm files.

    When I make the window only 320x48, it crashes when I tap the add - I think because it's trying to open a UIWebView but the windows too small or something.

    When i make the window full size 320x480, the add opens fine when I tap it, but now I can't tap the Unity Game controls.
     

    Attached Files:

  4. iCOOLgeeks

    iCOOLgeeks

    Joined:
    Mar 22, 2009
    Posts:
    65
    and .mm file.
     
  5. iCOOLgeeks

    iCOOLgeeks

    Joined:
    Mar 22, 2009
    Posts:
    65
    another try at attaching the .mm file. - I guess .mm files aren't allowed, so I'll add a .txt to the end.
     

    Attached Files:

  6. iCOOLgeeks

    iCOOLgeeks

    Joined:
    Mar 22, 2009
    Posts:
    65
    another try at attaching the .mm file. - I guess .mm files aren't allowed, so I'll add a .txt to the end.
     

    Attached Files: