Hwllo.
Just a ahort question.
Is there any way i can chamge the highlighted sprite via code in c# i cant seem to find it. Only targetgraphic
Hwllo.
Just a ahort question.
Is there any way i can chamge the highlighted sprite via code in c# i cant seem to find it. Only targetgraphic
You have to create a structure for the https://docs.unity3d.com/ScriptReference/UI.SpriteState.html
Did a simple test (never done this before):
[SerializeField]
Sprite hlSprite;
// Use this for initialization
void Start () {
SpriteState ss = new SpriteState();
ss.highlightedSprite = hlSprite;
GetComponent<Button>().spriteState = ss;
}
If you wanted other states, you’d have to assign them there, too.
Button must be set to Sprite Swap transition