1

How can I get the text from from a Unity InputField box when I click on a button?

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

public class input : MonoBehaviour
{
    public  InputField name;

    void Start()
    {
        var input = ToString(name);
        Debug.Log(name.text);
    }
}
Alex Myers
  • 6,196
  • 7
  • 23
  • 39
Pacub
  • 41
  • 7

1 Answers1

2
public void click() {
    Debug.log(name.text);
}

Make the button perform the click function.

How to add a function to a button

Ezray
  • 136
  • 8