how can I save text to input field with button?


I would like to save text to input field by clicking a button. My aim is to make form which is easier to fill. There is a inputfield for gender. Now players have to fill it by writing. I would like it to work so that I have two buttons. Other button is man and other is women. So the player can just click a button instead of writing his or her´s gender. With the script below text appears to screen. How can I modify it so it saves the gender to inputfield? I would apprecieate any guidance. Cheers.

using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class textBtn : MonoBehaviour

public Text mytext = null;
public int counter = 0;
public void changeText()
    if (counter % 2 == 1)
        mytext.text = "man";



Anyone? No one? someone?

You can use Drop Down Component instead. To create Drop down, right click on the canvas UI->Drowdown.

Follow this manual for dropdowns:

Use GetComponent().value to know which option is selected and use this value to identify what the user has used in the form.