Author Topic: NGUITools.SetActive issue  (Read 5575 times)

Clicker

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 16
    • View Profile
NGUITools.SetActive issue
« on: January 09, 2014, 09:30:37 AM »
Recently, I have encountered on a strange behaviour with the functions NGUITools.SetActive(bool). As far as I am aware, it should active only the root object in UNITY_4+ and it does that if the root object has at least one child active, but if there are only disabled children, it actually forces to enable them all. So that is the issue, because, for instance, as I have been using disabled objects in pools, in order to activate them again if they are needed.

P.S. I found some strange lines in the script NGUITools.cs, here they are: http://joxi.ru/GafOUhjKTJAzAdv-vRI (931 - 951). So, in my opinion, there is a mistake after line 945 in the case I just described above.

John.Bergman

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
Re: NGUITools.SetActive issue
« Reply #1 on: January 09, 2014, 12:39:44 PM »
I've been having issues with SetActive as well, I posed a description of what I was seeing with the other HudText related questions and issues.  In short, I could not get SetActive to enable/disable a UISlider after it was added dynamically to a HUD in game as part of a prefab that has multiple things that can be turned on/off.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUITools.SetActive issue
« Reply #2 on: January 09, 2014, 06:41:17 PM »
The different enabling logic is a side-effect of legacy functionality from Unity 3 days, when upgrading projects from 3 to 4. Its current behaviour is questionable, but might be safe to change now considering how long Unity 4 has been out.