Author Topic: What do you do with elements off screen?  (Read 3619 times)

dannyskim

  • Guest
What do you do with elements off screen?
« on: September 14, 2012, 02:19:16 AM »
Most everything that I design has some kind of panel hierarchy, and most everything will also animate on / off screen.  Question is pretty basic, but what do you do with all that GUI is off screen?

When working inside of Unity, if you have a menu scene with a lot of panels and elements that go on and off screen, what is the normal practice when those elements are off screen and inactive?  Do you disable them?  Do you just leave them be?  It looks like a terrible mess in the editor / game scene when all my menus are placed just off screen, and was wondering what is the more professional way of handling this. 

Obviously this makes no difference to the user when it is done right, but I would just like some opinions on the matter.  SetActiveRecursively() is obviously a huge hog, and I tend not to use it.

dlewis

  • Guest
Re: What do you do with elements off screen?
« Reply #1 on: September 14, 2012, 02:49:36 AM »
I personally leave the 'screen stack' active when off screen.

When I go to a new screen I create it (turn it on) and put it off the camera to the right. I then tween the current screen off to the left and leave it there and tween the new screen on from the right. When I go back I tween the top scene off to the right and disable it and tween the previous scene on from the left.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: What do you do with elements off screen?
« Reply #2 on: September 14, 2012, 03:46:52 AM »
It's all a tradeoff. If your screens do stuff in Update, you will likely want to turn them off when they are off screen - SetActiveRecursively / NGUITools.SetActive is not THAT expensive if you only do it once in a while.

I tend to enable/disable every time I switch screens.

dannyskim

  • Guest
Re: What do you do with elements off screen?
« Reply #3 on: September 15, 2012, 01:42:20 AM »
Appreciate the replies.  dlewis, I think you're going to have be a bit more specific.  What do you specifically use when you disable it? Do you simply cache the UIPanel script and disable the script, or do you use NGUITools, Active = false, etc...

Nicki:  I understand it's a tradeoff, but when you have a semi-complex UI and you use either SetActiveRecursively / NGUITools.SetActive, there is almost always a hiccup on mobile devices.  Sure, it's maybe a 100 - 200ms hiccup, but when you're designing for fluidity and polish in mind, these are rather irksome.

Any other suggestions would be appreciated.

dlewis

  • Guest
Re: What do you do with elements off screen?
« Reply #4 on: September 15, 2012, 08:47:22 PM »
Appreciate the replies.  dlewis, I think you're going to have be a bit more specific.  What do you specifically use when you disable it? Do you simply cache the UIPanel script and disable the script, or do you use NGUITools, Active = false, etc...

We have a 'scene' class which holds an array of all the objects in the scene (Only the root game objects of things in that scene) and when I enable/disable a 'scene' it will recursively call SetActive(t/f) on those objects. It's our own recursive function but NGUITools.SetActive should do the same thing.