I see one issue...the Get Children node. Is UI Element Get Children, not UI Canvas Get Children.
Three things I would check here:
That the Get hud node is actually being set to an entity. Does it have your player or hud entity as the value in the variable manager? Add a print node to print the EntityId value after GetHud (it should look normal, i think it does spit out a dummy entityId value if it isn't set)
That the entity with the canvas had enough time to load the canvas before you are asked for a reference to it. You might just avoid this problem by leaving the canvas unloaded and calling the load canvas node in this script you have posted. Otherwise I see that there is a 'On Canvas Loaded Into Entity' node that you can use to be sure the canvas ready to reference. The node should either fire immediately on connecting if the canvas is already loaded and ready or it will fire at some point after when it is ready.
If that reference to the canvas is all good, ensure that the canvas actually has child UI elements. Perhaps add a print node right after 'For Each' and see how many times it fires and that the EntityIds are all unique and match the count you would expect.
I decided to just do this
I made a script canvas just for the entity with the canvas and attached the script canvas to it. This doesn't have any output at all. It doesn't print a thing. The UI Canvas has children.
It won't even spark that event.
The canvas loads fine but it doesn't seem to be loading into the entity. I know the canvas loads because I can see the GUI.
Not even that works. I meant "HUD LOADED INTO ENTITY" ftr
Another thing to check is that the UI component is on the same entity you are referencing in the 'GetHud' node. If, in your level layout, your top-level 'Player' entity has the UI component and you are referencing 'Player' in GetHud, that all sounds fine. If your Player entity has a child entity called Hud or something, and the child actually the entity with the UI component, then the child component needs to be the referenced EntityId in GetHud.
Here is an older forum post with a two-part tutorial on working with the UI in scriptcanvas, it has the scriptcanvas graph there too, the layout is probably jumbled, it's from an older version of Lumberyard. The tutorial doesn't cover cross-entity referencing, but plenty on wrangling UI canvases with some of the caveats of referencing them.
If I do this then I can get HUD LOADED INTO CANVAS print statement to work. But it still doesn't print children.
For that graph to work, it would have to be on the entity with the UI component, because the source is set to self.
If this graph is on a different entity you'll need to change the source.
The graph ("hud.scriptcanvas") is now connected to an entity called "hud" which has a canvas ref attached called "hud" which is hud.uicanvas that has children.
I did that to attempt to isolate what the problem is. I have no idea why I can't get access to the children in hud.uicanvas which is attached to entity "hud" which has the above graph in it which is a scriptcanvas "hud.scriptcanvas" It will not print out any of the children.
This is what I currently have. And I can get this "(Script Canvas) - HUD LOADED INTO ENTITY: " but that's all I get.
I should get all the children but I do not. I have no idea how to know if that big long number is a "dummy" number or not.
OK that sounds like a good setup to work from. That EntityId looks fine.
I also tried a different uicanvas file just to see if the hud one is corrupted. It doesn't work with either uicanvas file. Can't print out children.
Those nodes that have the same name but slightly different categories get me plenty.
DOH! all I did was search "get children" and assumed since it was UI it was appropriate. That fixed it. THANK YOU!
You got it! That tutorial might still be worth a look for the caveats...there is another category, UI Canvas Manager that can be useful but you have to mind the pathname, that's covered in one of those pdfs.
Adding new answers, comments, and votes is disabled.
- Accepted Answerasked 6 years ago
- Why am I getting an Access Denied error when I open the URL to an Amazon S3 object that I have access to?AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 9 months ago
- EXPERTpublished 5 months ago