Author Topic: Visibility Changed delegate?  (Read 2438 times)

Maxii

  • Jr. Member
  • **
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 55
    • View Profile
    • Strategic Forge
Visibility Changed delegate?
« on: October 04, 2014, 03:35:22 PM »
I'm looking for a way to be notified when a widget or panel transitions into/outof camera line of sight like MeshRenderer.OnBecameVisible/Invisible does for meshes. As UISprite doesn't use a MeshRenderer, I don't have that notification available to me.
I'm looking for an artist partner to complement my programming skill in developing a space-based Civilization-like empire building game, ala GalCiv2 or Distant Worlds based on Unity3D.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Visibility Changed delegate?
« Reply #1 on: October 05, 2014, 09:02:51 AM »
UIWidget.isVisible tells you whether it's visible, but there is no delegate for this. You have to watch for it changing.

Maxii

  • Jr. Member
  • **
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 55
    • View Profile
    • Strategic Forge
Re: Visibility Changed delegate?
« Reply #2 on: October 05, 2014, 10:23:48 AM »
Would you consider a feature request then?
I'm looking for an artist partner to complement my programming skill in developing a space-based Civilization-like empire building game, ala GalCiv2 or Distant Worlds based on Unity3D.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Visibility Changed delegate?
« Reply #3 on: October 06, 2014, 08:43:00 AM »
It seems like this would add overhead to every single widget, even though in 99.9% of the use cases this isn't going to be used. I'd say this is best as an additional script attached to whatever you want to be tracking this kind of thing.

Maxii

  • Jr. Member
  • **
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 55
    • View Profile
    • Strategic Forge
Re: Visibility Changed delegate?
« Reply #4 on: October 06, 2014, 08:59:03 AM »
Thanks for considering it. I take it you are referring to a script that polls isVisible during Update?
I'm looking for an artist partner to complement my programming skill in developing a space-based Civilization-like empire building game, ala GalCiv2 or Distant Worlds based on Unity3D.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Visibility Changed delegate?
« Reply #5 on: October 06, 2014, 10:39:00 AM »
I'd put it in a coroutine, but yes.