Author Topic: Grid with a lot of children crashes IOS Build  (Read 5668 times)

Zophiel

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 54
    • View Profile
Grid with a lot of children crashes IOS Build
« on: December 03, 2012, 12:17:42 PM »
Hello,

I've created a draggable clipped panel as the documentation shows. But adding around 12 children will crash the IOS app but work fine in the editor. No errors show up in the XCode console either. I've reduced the children to about 4 and that seems to work fine.

I got 12 textures that i need to be fullscreen. Any idea why this is causing the crash?
« Last Edit: December 03, 2012, 01:37:00 PM by Zophiel »

Zophiel

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 54
    • View Profile
Re: Grid with a lot of children crashes IOS Build
« Reply #1 on: December 03, 2012, 12:34:22 PM »
Perhaps i've set up the Ui incorrectly?

What's the best way of doing the following? I need 12 textures to scale to the screen resolution. Switch to SD textures for Iphones and be a scroll view.

So i've setup the scroll bits as is described in the documentation. The grid does require a cell size. I recon i can adjust the code a little and change the cell size on Awake(). Then put a Stretch on all the child panels?
« Last Edit: December 03, 2012, 01:36:47 PM by Zophiel »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Grid with a lot of children crashes IOS Build
« Reply #2 on: December 04, 2012, 02:44:21 AM »
No error in XCode? That seems odd. With 12 full screen textures you may be simply running out of memory. Be sure to unload them if you don't need them.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Grid with a lot of children crashes IOS Build
« Reply #3 on: December 04, 2012, 04:04:35 AM »
If you use iOS 6 then xcode gets very little stuff in the console. Try a device with an earlier iOS.

Zophiel

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 54
    • View Profile
Re: Grid with a lot of children crashes IOS Build
« Reply #4 on: December 04, 2012, 07:47:32 AM »
@ArenMook I think you're right. They are, after all, 12 x retina resolution. What's the best way to unload a texture? I could probably use the MonoBehavior.OnBecameVisible() to toggle on and off or something.

@Nicki Yeah using Ios6 and sadly i've updated all my devices to ios6 a while ago :(
« Last Edit: December 04, 2012, 08:05:46 AM by Zophiel »

nah0y

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 430
  • \o/
    • View Profile
Re: Grid with a lot of children crashes IOS Build
« Reply #5 on: December 04, 2012, 09:02:17 AM »
The best way to load/unload textures in Unity is to have them in a Resources folder (but only the textures goes into this folder).
Then you can load them using Resources.Load("yourTexturePath") and when you're done with them, just do Resources.unLoadAsset(yourTexture)

Zophiel

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 54
    • View Profile
Re: Grid with a lot of children crashes IOS Build
« Reply #6 on: December 04, 2012, 04:23:43 PM »
@Nahoy certainly did the trick. Another thing that work was applying good compression to the textures and now ios can take it.

I have another problem though, which i'm sure many of you have dealt with. I've toggled off manual and set the manual height to 768 for the ipad. But when i run the app on an iphone i get a lot of space on the sides and you can then see the next panels and the clip area. How can i get rid of this?

nah0y

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 430
  • \o/
    • View Profile
Re: Grid with a lot of children crashes IOS Build
« Reply #7 on: December 04, 2012, 04:27:09 PM »
I use the exact same technique, I set my manual height to 768, and it works fine across ANY mobile/tablet resolution. The only thing is that I have a little more space on the sides of some devices (depending on the aspect ratio).

And for this, the only thing you need to take care of, is having a "big" background image, having something tilable for example, or just a 3 of the same backgrounds that repeats (you add one to the left of the one in the middle, and one to the right).

You see ?

Zophiel

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 54
    • View Profile
Re: Grid with a lot of children crashes IOS Build
« Reply #8 on: December 04, 2012, 04:45:02 PM »
I understand. Here's a screenshot of what my app actually looks like to give an idea. As you can see the clipping isn't setup correctly perhaps or else you'd see black borders.

nah0y

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 430
  • \o/
    • View Profile
Re: Grid with a lot of children crashes IOS Build
« Reply #9 on: December 04, 2012, 04:48:41 PM »
Which clipping ?

Your black background should be a sliced sprite with a width of 1400 for example and it should do the trick for every screen right ?

Zophiel

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 54
    • View Profile
Re: Grid with a lot of children crashes IOS Build
« Reply #10 on: December 04, 2012, 04:54:16 PM »
The black area is 1024 x 768, so are the slides. The clipping area for the draggable panels is the same size. Going to 960 x 640 when the manual height is set to 768 will create those bars on the sides when viewing the app on an iphone.

But the clipping doesnt seem to 'hide' the panels that aren't meant to be shown.

nah0y

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 430
  • \o/
    • View Profile
Re: Grid with a lot of children crashes IOS Build
« Reply #11 on: December 04, 2012, 04:56:47 PM »
Hum ok I think I understand, but then you can't do anything about that I think, and well, I think it's not a big deal to see the other panels on the side :)
But I still don't understand why you need to clip anything here.

Zophiel

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 54
    • View Profile
Re: Grid with a lot of children crashes IOS Build
« Reply #12 on: December 04, 2012, 05:45:00 PM »
Well i just need the panels on the left and right to not show. It's not really what the designer had in mind.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Grid with a lot of children crashes IOS Build
« Reply #13 on: December 05, 2012, 03:42:14 AM »
Try turning on gizmos to see where the actual clipping is. You may want to resize the cliprect to fit the size you want.
And remember clipping just means that nothing gets drawn, by that panel in that camera. That means, that if you have another panel below that is still in that area, it would still get drawn. And if you have another camera that draws before, it would still show up on screen.

Your screens would have to be in the same panel or it to clip correctly.