Hi Chris, I wonder if you can please help me with the last little bit of trouble I'm having with getting a Sam & Max style icon-based conversation thing working.
I have it mostly working, and have even got a little LLM-generated script attached to each 'button' to make it hover when the mouse is over it.
The problem I'm encountering is - for each conversation entry, I have an icon eg a ? or ! or X, and like you've done with the similar demo AC Menu, I'd like it to have a background image for the slot, and have the icon is placed over the background slot image. That way I only need to provide the conversation icons a transparent background and they would be placed over a little drawn square.
The problem I'm having with UnityUI is - I can't seem to find a way to target the child of the button to replace the conversation icon image. I could flatten the '?' icon and the background square onto one image and that works fine, but if I have a:
AC's menu will only accept an object with the button component, and will replace whatever image is on that object.
If I reverse the order:
Then as you can imagine, the button background square appears in front of the image icon.
My only option currently seems to be using a single image, with the icon and background in one image, and having no nesting, just single entries - objects with a button and image component on them.
However I wondered if there were a way for the ConversationUI to replace an image while still having a background image behind it? I've tried various setups - either the link gets lost if I have nested buttons, or I can only get the icon to appear behind the background square, obscuring it.
I see there's also a setting for 'Link Graphics to: Button Target Graphic' but I can't find anything about that in the manual or forums, and couldn't figure out how to make the link target a child of the target object.
Many thanks.
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Yes, it's the Link graphics to field that should handle this.
When set to Image Component, it'll link texture-assignment to the first-found Image component in the Button's Hierarchy. A child Image component will be used only if no Image component it on the root.
When set to Button Target Graphic, it'll link it to the Button's assigned Target Graphic, provided it's an Image. The Hierarchy position of this assigned Graphic is not accounted for.
Setting it to this may be enough, given that you're using a separate script to handle hover effects, but you might also be able to use the Image Component option, and replace the Image component for your "?" icon with a Raw Image.
Ah, joy, thank you.
Yes, it's working properly now. I was missing the step of how to set the button's target graphic, but it's right there in the component / inspector.
Simple as having the conversation Linked Button Object as:
Then setting the icon image to the button's target graphic in the button's inspector, and enabling 'Link graphics to: Button Target Graphic' in Menu's setting.
Thank you.