Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ObjectCollection does not remove moved GameObject that is no longer a child from NodeList #1868

Closed
MSDNAndi opened this issue Mar 23, 2018 · 6 comments
Projects

Comments

@MSDNAndi
Copy link

MSDNAndi commented Mar 23, 2018

Overview

UpdateCollection() in ObjectCollection does not remove moved GameObject that is no longer a child from NodeList. It only removes GameObjects from NodeList that do not exist anymore, resulting in a wrong number of children and wrong layout

Expected Behavior

When a GameObject is not a child, it should not be in the NodeList holding the children that should be laid out.

Actual Behavior

See above.

Steps to reproduce

Add a GameObject (e.g. the cube primitive) as a child to a parent GameObject that has ObjectCollection, then call or select UpdateCollection, then move the GameObject elsewhere so it is no longer a child of the GameObject, select or call UpdateCollection on the parent GameObject. NodeList still contains the moved GameObject, resulting in the layout considering too many children.

@MSDNAndi
Copy link
Author

While I believe I contributed a fix, for the issue described, I still find funky behavior when it comes to hierarchical object collections and their members, where I am not sure about the reason for it yet. I am not sure yet how to describe and repro the observed behavior I am still seeing.

@MSDNAndi
Copy link
Author

MSDNAndi commented Mar 26, 2018

I think I need to rework the fix. I should not have used IsChildOf as it uses deep children.

if (NodeList[i].transform == null || (IgnoreInactiveTransforms && !NodeList[i].transform.gameObject.activeSelf) || NodeList[i].transform.parent==null || ! (NodeList[i].transform.parent.gameObject==this.gameObject) )

Seems to be the better fix. I am not sure if I should open another issue and work against that new issue, if I should submit against this issue, or if I should just edit it again.

@david-c-kline
Copy link

Please open a new issue and pull request.

Thanks!

2017.2.1.4 automation moved this from In progress to Done Mar 27, 2018
2017.2.1.4 automation moved this from Done to In progress Mar 27, 2018
@StephenHodgson
Copy link
Contributor

Please keep issues open until they're merged with the master branch.

@MSDNAndi
Copy link
Author

MSDNAndi commented Mar 27, 2018 via email

@david-c-kline
Copy link

@MSDNAndi, Yes. We will close the issues when the release complete.

2017.2.1.4 automation moved this from In progress to Done Apr 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
2017.2.1.4
  
Done
Development

No branches or pull requests

3 participants