- Home /
Prevent Button from tinting child Images
I want a button to only Transition between colors on its own image, not on any of its children, or at least let me choose which ones. How can that be done?
A colleague of mine has created a button which had child objects, 2 texts, 2 images. The texts were tinted along with the button where the images were not.
Even more strange, I recreated that structure and could not get the images to not tint along with the button... every component was configured the same. even childing just the image over to the other button made it tint...
I took two shots. First shows the selected image, which is unaffected by the cursor hovering over the button The second one shows the affected one. IT'S A COPY OF THE FIRST. How is that possible?
Buttons do not animate their children by default. I can't tell from your two images what the issue is... I see one icon as black and the other as blue, but this is because you set those colors in each Image component (one is white, other black). The images seem otherwise identical, so I can't tell what is going on if that isn't the issue.
Hey callen, thanks for the reply. the original color is blue. both shots were taken while hovering the button. the first buttons tint stays white, while the second gets black from the button due to tinting... I really genre no clue why one is ignored while the other, the copy, is not
The Button component (which actually does the tint animations) is not shown, and the Image.Color in your screenshots matches the colors on-screen (as expected). This Image.Color is not changed during a Button tint animation (even if the final onscreen color is), so whether you were hovering over the button or not, the Inspector panel won't look any different than this.
$$anonymous$$aybe you need to add a screenshot of the Button component? Or maybe I'm missing something still :P
Edit: also to clear at least one thing up, the only graphic that is altered by a button's tint animation is the one assigned to Button.TargetGraphic.
well no, they don't match. the first is white (image), the second is black (image(2)). both are children of the same button with transition colors white to black. the screenshots were taken while hovering. why is one still white but the other became black. blue is the sprites color as is. IF the button was the only object changed I wouldn't be posting this. it references itself as targetgraphic
Answer by hexagonius · Dec 11, 2015 at 08:08 AM
Solved it,
some idiot derived from the button component, coloring every child Image in the hierarchy with an array of ignored once...
Your answer
Follow this Question
Related Questions
UI drag and drop 1 Answer
Drag handler is blocking image IPointerClick but not button OnClick 0 Answers
New UI Button: Have sprite fill entire button (overflow). 1 Answer
How to click on button that is behind transparent image in New UI? 2 Answers
Buttons become invisible when changing color (on Button or on Image) in script -1 Answers