Hello. I want to create my website game savable but when i tried and do that it give me a error that loadlevel cannot convert float to int? and i cannot convert my float values to int because they must be float in my game or my hole code and game will break. Then how do i load saved game if it cannot do that with floats? any ideas? here is the load save game code:
using UnityEngine;
using System.Collections;
public class LoadSaveGame : MonoBehaviour {
public void loadsavegame(){
if (PlayerPrefs.HasKey ("floatt")) {
Application.LoadLevel (PlayerPrefs.GetFloat ("floatt"));
} else {
Debug.Log ("Savegame was not found. Canceling load save game.");
}
}
}
And here is the errors i am getting:
1. Assets/Cookie Clicker/Scripts/Game/LoadSaveGame.cs(9,37): error CS1502: The best overloaded method match for `UnityEngine.Application.LoadLevel(int)' has some invalid arguments
2. Assets/Cookie Clicker/Scripts/Game/LoadSaveGame.cs(9,37): error CS1503: Argument `#1' cannot convert `float' expression to type `int'
I hope someone can help me with this i really need to save those floats in my game.
↧