Quantcast
Channel: Questions in topic: "playerprefs"
Viewing all articles
Browse latest Browse all 1333

PlayerPrefs Float in LoadLevel does not work?

$
0
0
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.

Viewing all articles
Browse latest Browse all 1333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>