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

Unknown parent #3

Open
Bombardir opened this issue Jun 13, 2015 · 13 comments
Open

Unknown parent #3

Bombardir opened this issue Jun 13, 2015 · 13 comments

Comments

@Bombardir
Copy link

Latest updates broke my UI.. I have problems with error 'Unknown parent'. My json:
[
{
"name": "MainPanel",
"components": [
{
"type": "UnityEngine.UI.Image"
},
{
"type": "RectTransform",
"anchormin": "0.2 0.2",
"anchormax": "0.8 0.8"
}
]
},
{
"name": "ActivePanel",
"parent": "MainPanel",
"components": [
{
"type": "UnityEngine.UI.Button",
"command": "....."
},
{
"type": "RectTransform",
"anchormin": "0.2 0.2",
"anchormax": "0.8 0.8"
}
]
},
{
"name": "TitlePanel",
"parent": "ActivePanel",
"components": [
{
"type": "UnityEngine.UI.Text",
"text": ".....",
"align": "MiddleCenter",
"fontSize": 32
}
]
}
]
Error: 'AddUI: Unknown parent: ActivePanel'
P.S. It's not real json (real is too big), but an example.

Previously all was okay, but with new updates it's not working.

@AlexALX
Copy link

AlexALX commented Jun 14, 2015

Can confirm issue. I'm also having problems even with default json code what are inside CommunityEntity.UI.cs.

When run default code first time - everything ok, button have text and all works. But after close it and open again - i'm getting in console "AddUI: Unknown parent: Button88", and button don't have text anymore. After reconnect to server you again can see text on button first time, but not second etc.

@ZuenTheMan
Copy link

Confirmed as well.

@kemhost
Copy link

kemhost commented Jun 14, 2015

Also confirm that the problem.
Fix it as soon as possible

@SannyOK
Copy link

SannyOK commented Jun 14, 2015

Agree with that! Need to be fixed!

@ZuenTheMan
Copy link

Further investigation shows that the UI is not properly being destroyed at all. I did some testing on the naming of each component and it seems that if you generate a random name every time the server sends the UI it will 100% always show up.

So instead calling it something static such as "TestPanel7766" you should make it unique every time it gets called like "TestPanel7766" | "TestPanel7767" | "TestPanel7768" and so on.

This is only a temp solution for those that requires it to work asap.

@Bombardir
Copy link
Author

Latest update haven't fixed this error.

@ZuenTheMan
Copy link

I made a Pull Request to fix the issue but was turned down so lets hope they can find a similar fix at least! :)

@virtyvoid
Copy link

@garrynewman Will this be ever fixed? :)
Test case: F1 > cui.test > "YES" > cui.test = "AddUI: Unknown parent: ..." and missing text on the button.
For now, every UI developer is forced to make a random name for the button.
It's a pain in the ass and probably a memory leak too.

@ZuenTheMan
Copy link

@virtyvoid This is not directly a 'real' memory leak. The list that stores the GameObject of each UI component is not being removed from the list. The reason for generating a random name with every UI call is because the list already has the old name stored.

@virtyvoid
Copy link

@ZuenTheMan Well, thanks for clarifying, i've read your article too.
But unfortunately the problem persists. I hope they will add the problem to their TODO list at least.

@Viproz
Copy link

Viproz commented Jul 28, 2015

This issue is fixed with my PR, tested it in Unity already

@ZuenTheMan
Copy link

You have more of a rewrite all the original code instead of fixing the single dictionary list that is causing the issue. Also why change how the current JSON works? UI can easily be nested under parent UI by using "name" and "parent".

[edit]
I checked your code and I saw some issues. I just read through them and have not tested them.

@Viproz
Copy link

Viproz commented Jul 28, 2015

The way it was stored made no sense, had to completely change it
For the json I changed it because it made no sense to do it like that, you couldn't see any structure or anything
Note that you can more than ever change some UI parts, you just need a path with named object if you want to be able to destroy it (like MainPanel/Image/Button)

Commented about your issue on the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants