I have a button with an Edit image, on click, the image changes to a save icon.
Now, when I click the save icon on button I want it to execute another function to save().
When I click button first time, it uses the onCLick in components change the image to a save image, it opens up an InputField and i type in a name.
When I click on the same button I want it to now execute the save() on the Inputfield Text
If the script the button uses looks like this, then it should do what you want:
public class ButtonSave : MonoBehaviour
{
public bool ClickedOnceAlready;
public void OnClick()
{
if (!ClickedOnceAlready)
{
// Change the image to a save image,
// Open up an InputField and type in a name
ClickedOnceAlready = true;
}
else
{
Save();
}
}
private void Save()
{
// Save name or whatever
}
}
It uses a bool to keep track of whether the button was pressed for the first time, or not, and runs the appropriate method, depending on the state of the bool ClickedOnceAlready. @motti10