why do i get 0

//var systime:int=10;
var health:float=100;

function Update () {

    if (Input.GetKey ("up"))
         //systime =System.DateTime.Now.Hour;
		 var systime:int =PlayerPrefs.GetInt("systime");
		 PlayerPrefs.SetInt("systime", System.DateTime.Now.Hour);}

    if (Input.GetKey ("down")){
        print (systime);

Looks like your systime variable is scoped to the “up” block and therefore non existent in the “down” one. Move the var systime:int =PlayerPrefs.GetInt(“systime”); in the other block.

Variables declared outside any function are member variables, and their lifetime is the same of the script; variables declared inside a function are temporary variables: their lifetime is the duration of the function (they are deleted when the function returns).

Since you commented out the systime declaration as a member variable and declared it inside Update, systime became temporary, and respawn each Update with value = 0.

Uncomment the first systime declaration and remove the one inside Update (let only systime = PlayerPrefs.GetInt(“systime”)), and things should start working.