Button btn = Images[k].GetComponent<Button>(); if (btn != null) { if (btn.transition == Selectable.Transition.SpriteSwap) { int counter = 0; SpriteState state = btn.spriteState;//通过这个属性获取,是一个结构体 if (state.highlightedSprite == a) { counter++; state.highlightedSprite = b; } if (state.pressedSprite == a) { counter++; state.pressedSprite = b; } if (state.selectedSprite == a) { counter++; state.selectedSprite = b; } if (state.disabledSprite == a) { counter++; state.disabledSprite = b; } if (counter > 0) { btn.spriteState = state; } } }