Search Unity

Question Differences between Sprite Swap and Color Tint buttons?

Discussion in 'Scripting' started by CaxtNova, Feb 24, 2024.

  1. CaxtNova

    CaxtNova

    Joined:
    Mar 27, 2019
    Posts:
    4
    For context, I'm currently trying to solve an issue where Sprite Swap buttons aren't behaving the same as Color Tint buttons for the purposes of creating a scroll container that automatically scrolls with your selection, to work with a controller. https://forum.unity.com/threads/scrollview-using-controller-arrowkeys.1008121/#post-9662246

    That being said, I want to get a better understanding of how Unity handles sprite swapping and tinting of selectable objects. Clearly something is different, based on the differences in behavior I'm seeing. Do sprite swaps and color tints happen at different parts of the update cycle? Do sprite swaps cause the proportions of the button to change behind the scenes before applying the new sprite, in a way that color tinting doesn't? Is there something different in the way that a sprite swapped button stores its data from a color tint button, independent of when the sprite swapping is actually being performed?

    Any intel would be appreciated! Scraping my brain across all references to the Selectable class in the code base has not been very productive thus far...