Inputfield wont set a string

i want to set an inputfield to string so i can set it to a text file but the inputfield doent set the string

script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System;
using System.IO;
using UnityEngine.EventSystems;
using UnityEngine.SceneManagement;
public class mapUIScript : MonoBehaviour {
    public InputField inputFieldPoints;
    public string selectedDificulty;
    public string selectedPoints;
    //string points;
    void Start () {
        selectedDificulty = "";
    }

    void Update()
    {

    }
    public void Easy()
    {
        selectedDificulty = "Easy";
    }
    public void Medium()
    {
        selectedDificulty = "Medium";
    }
    public void Hard()
    {
        selectedDificulty = "Hard";
    }
    public void SetPoints()
    {
        selectedPoints = inputFieldPoints.ToString();
    }
    public void BackMainMenu()
    {
        SceneManager.LoadScene("menu");
    }
    public void StartButton()
    {
        System.IO.File.WriteAllText(Application.dataPath + "/MapOptions.save", selectedDificulty+ "\n"+selectedPoints);
    }
}

how are you calling “SetPoints()”?

with a button

oh, you’re not accessing the text property of the inputfield

selectedPoints = inputFieldPoints.text;
1 Like

still doent set it the selectedPoints is still empty

found it, for the set points i used an old prefab, it works fine thanks