Author Topic: UIGrid's child objects which have been deleted are appeared for a moment  (Read 4673 times)

sonee

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 11
    • View Profile
Hi,

This bug seems to be appeared from 3.0.6. The gameobjects that UIGrid gameobject had were appeared for a moment(1 frame) when destroying its parent. Before destroying widgets, we move all widgets to out of screen, then they are deleted. So when destroying the parent, all child objects were out of screen. Curiously enough, I tried to pause the scene to capture the situation but never found any gameobjects related to the situation in Hierarchy window of Unity.

Additionally, in the latest version (3.0.6f7), UIDragScrollView component can't find its parent which contains UIScrollView in contrast to the previous version.
« Last Edit: December 02, 2013, 12:19:49 AM by sonee »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIGrid's child objects which have been deleted are appeared for a moment
« Reply #1 on: December 02, 2013, 09:18:07 AM »
I'm not quite sure what you mean there... game objects appeared for a frame when destroying its parent? How do you destroy the parent? I can use some steps to follow here.

As for the scroll view issue... I am guessing that happens because your child objects get enabled before parents -- which is a bug in Unity. Do you use GameObject.SetActive() to activate something? Switch to using NGUITools.SetActive instead. It enables parents before children correctly.

Just to be on the safe side I'll add code to also find the component in Start() in the next update.

sonee

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 11
    • View Profile
Re: UIGrid's child objects which have been deleted are appeared for a moment
« Reply #2 on: December 03, 2013, 01:51:11 AM »
I created the simple scene you can test it.
Download it then do resetting the sprites of "src_item" in hierarchy. you may be able to see the sprite for a frame when destroyed. Curiously enough, it's cleared when uncommenting line 44 in gridtest.cs.
It looks to only happen when destroying and creating widgets are processed at the same frame.

sonee

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 11
    • View Profile
Re: UIGrid's child objects which have been deleted are appeared for a moment
« Reply #3 on: December 08, 2013, 10:03:24 PM »
Did you check the issue with the scene I've attached?
I'm not quite sure what you mean there... game objects appeared for a frame when destroying its parent? How do you destroy the parent? I can use some steps to follow here.

As for the scroll view issue... I am guessing that happens because your child objects get enabled before parents -- which is a bug in Unity. Do you use GameObject.SetActive() to activate something? Switch to using NGUITools.SetActive instead. It enables parents before children correctly.

Just to be on the safe side I'll add code to also find the component in Start() in the next update.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIGrid's child objects which have been deleted are appeared for a moment
« Reply #4 on: December 09, 2013, 12:57:19 AM »
Wasn't this fixed in 3.0.7?

sonee

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 11
    • View Profile
Re: UIGrid's child objects which have been deleted are appeared for a moment
« Reply #5 on: December 09, 2013, 03:06:57 AM »
No, I checked it in 3.0.7, but it still happens. :)

Wasn't this fixed in 3.0.7?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIGrid's child objects which have been deleted are appeared for a moment
« Reply #6 on: December 09, 2013, 07:20:37 AM »
Hmm. Well, I had a look at your example, and it seems to work fine once I get rid of the warning on the panels. You have both panels on the same depth. Place them on separate depths and all is dandy.