Author Topic: Tween the alpha of groups of objects with the new panel depth...  (Read 4371 times)

KyleStaves

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
I have what's not a problem, but more just an inefficient workflow issue with the new panel depths. First, I find them insanely handy for my major panels - I can say the game's Codex is depth 51 and never worry about issues with it clipping through [insert other random window that may be open underneath or on top of it]. However, I make very frequent use of fading in and out groups of sub objects. If the groups of objects always faded from 0->1 and back again it would be easy to just make a new component that handles this for me by grabbing all the child widgets. However, I also frequently have situations where one or more of the widgets isn't 1.0 alpha - it's some other value when the group is fully opaque.

Anyhow, pre 3.0.2 my work flow for this was simply to use panels for these groups and fade in and out the alpha of the panel. It works splendidly satisfies all of my needs. I use this setup frequently with prefabs that will spawn as children of the main panel at runtime, which also works great.

With the introduction of panel depth, however, I've found myself fighting those numbers and missing children panels somewhat frequently - especially with the prefabs that spawn at runtime. It also makes changing the depth of one of the major panels a bit of a pain (as I then have to go through the process of identifying all of the children panels and updating them as well, many of which are in separate prefabs).

So, I'm wondering if anyone in the community has a better approach for this or if it's just worth working around? My one immediate workaround thought is to create an "InheritPanelDepthFromParent" component that just crawls the hierarchy up in Start and identifies the first panel without such a component and copies it's depth. Then I'd write a real quick editor window that just identifies all UIPanels in a scene that have a parent but do not have this component (not auto-adding the component though, as obviously sometimes that wouldn't be desirable). It would still involve some extra steps, but it would let me take advantage of the awesome new panel depth feature and would completely eliminate the "well what if I update the Depth of a parent panel sometime later and forget to update this random prefab that doesn't always get spawned at runtime" worry.

Anyhow, I appreciate any thoughts/input!