Reputation: 189
I have a very unique bug when I dynamically switch between menus by setting them to active/inactive with .SetActive(). The bug is that one and only one of the menus is not recursively setting its children even though the parent object is set to active. I've read that child objects won't be affected by the parent SetActive if they are unchecked in the inspector, but I can check every single object as active and it still happens. I guess my question then is, is there something I can do in the editor to reset the objects so that they work again?
I'm not going to provide any of my code because this must be an issue with the editor. My objects are handled dynamically, and it is only one of the menus that is misbehaving.
Upvotes: 0
Views: 220
Reputation: 1
The issue seems a little confusing, but perhaps more context could help. Child objects have their own SetActive value which does not affect the Parent's SetActive, so it sounds like the Child object was SetActive(false) and the Parent object was SetActive(true). Also just to note: "unchecking" something in the inspector is the same as SetActive(false).
Other potential causes could be perhaps the user input is not being received. For example, if you click a button and the expected behaviour is for the old menu to disappear, and the new menu to appear - are there other issues, like the old menu failing to disappear?
If you resolved the issue by copy-pasting the items across to a new empty object, I have no idea lol.
Upvotes: 0
Reputation: 189
I just made a new game object to replace the parent, and moved all the children to it. Now it works fine! I have no idea what would cause that. Maybe a bug.
Upvotes: 0