StreamReader to a float?

How can I do StreamReader to a float?
I’ve tried a lot, but it has not succeeded.
This is my code:

import System.IO;
static var POINTS : float = 0;
var fileName = "data/";
var txt = "";

function Start ()
	sr = new StreamReader(fileName);
	txt = sr.ReadLine();
	//POINTS = sr.ReadLine();
	//POINTS = sr.ToString();

Sorry for the translations, I come from the Netherlands.

txt variable should contain the text read from the file!! if that float is the only data in the particular line then it is simple, do as below

after reading from the file,


if it has lot of other data in the same like you can use either use Read function. If you want to stick to ReadLine() function still you can use Split method from String class after reading the data.

if this float is the only data you are going to save for the whole game!! ( ma be very few less than 50 or so) you can consider using PlayerPrefs class from unity, lets us save variables and read it back later?
If u thing it helps select as accepted answer :slight_smile: