Hi
Can anyone advise how to make button at pause. I want to be when you play have sprite and at pause other, not make it go away when you press the right. Like music on / off… I can not find anything with Unit 5 UI system.
Thanks a lot
Hi
Can anyone advise how to make button at pause. I want to be when you play have sprite and at pause other, not make it go away when you press the right. Like music on / off… I can not find anything with Unit 5 UI system.
Thanks a lot
Easiest option maybe to use the built in disabled flag?
Then use the Transition: sprite swap and set the Button.enabled = false;
If this is not an option then you can just change the sprite image in code:
make sure you have at the top somewhere…
using UnityEngine.UI;
Then:
public Sprite disabledSprite;
public Button myButton;
in your OnPause method…
myButton.sprite = disabledSprite;
A button that turns on / off, isn’t really a button, what you are looking for is the TOGGLE control.
If you want it “button like” then simply replace the background and checkmark images and position them appropriately.
Or just look at the setup and build your Button/toggle manually adding the components as required.