I have a question about the UI.
I'm considering adding a Property to the Document in the Inventory and allowing players to input its contents.
I want to display the Documents in a DocumentListMenu. Is there a way to show both the Document's image and the added Property at the same time?
Since there are many Documents, it needs to be possible to offset them using buttons.
Thanks!
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
It's possible, but currently most likely through custom script. I'll need to be sure of your intent, however.
By "list", do you mean to display all Documents, with images and properties for each, in a list - or a list of Document titles, and only show the "selected" Document's image / property?
If you can share a mockup image of your intention, that'll help clarify the situation.
Thanks for your reply!
My assumption is that “all image files and properties are listed together.”
I made a sample image. It's very rough, but...
Please let me know.
https://imgur.com/a/6pVb8TP
Thanks.
You'd need to rely on Unity UI for your Menu's Source, and then add each of the "Property" labels as Text components that you can then control through script. These would not need to be linked as Label elements - only the Image components that represent the Document icons. These would all be linked to a single InventoryBox element that shows Collected Documents, which the script would then reference to extract the relevant property data:
This script would be attached and assigned to each Text object, with each having its unique "Slot Index" value set. You can use TextMesh Pro instead of Text if you want. Edit the string variables to match what's in your game and it should pull the property value from each of the Documents and update the UI.
Thank you for your reply! I tried it, and it worked!!
You always give me courage!
Thank you so much.
Excuse me, I have one more question.
I want to write a process in a script that compares the value of a property added to all documents with a specific value, and if it’s True, it will ‘do something’. Could you give me some hints?
@ChrisIceBox
This'd do it:
It went well!
Thank you as always.
I'm sorry to bother you so many times.
Could you tell me how to change a Document's property from a script?
Since there is a GetProperty, I thought there might be something like SetProperty, but I couldn't find it...
@ChrisIceBox
Once you have a property reference via GetProperty, you can then change it's value:
Do be aware, however, that changes to Document properties at runtime will affect their original values in the Variables Manager. I recommend instead storing dynamic values in the Variables Manager.
I did it!
Thank you as always!!
@ChrisIceBox
Excuse me, I have another question. It might be something very basic.
I want to display the MainGraphic of a Document in a Unity UI that I made myself, but I don't know how to do it...
This is for a single Document rather than a list?
The Menu: Update content Action can be used to set a Graphic element to a Document's main texture, provided you have a Document parameter in the ActionList.
Thank you for your reply. Sorry, I didn’t provide enough explanation.
When an item is selected from the DocumentList, the original menu I created will open.
I want to create an area in that menu to display the MainGraphic of the selected document.
Create a Graphic element and set its type to Document Texture.
Thank you.
I tried it, but only a white square appeared in the Graphic area, and the Texture was not displayed...
Share images and I'll see if I can spot the issue.