Answers for "Save variable unity"

C#
2

how to make a variable unity

public GameObject objectName; //creates a gameobject with the name "objectName"
private float myDecimal = 0.25f; //creates a float with the name "myDecimal";
//note that decimal floats have to end with 'f' and floats can be any numerical value.
Posted by: Guest on April-12-2021
0

Save variable unity

//set any string value
PlayerPrefs.SetString("varName", "any string info here");

//Get any string value
Text.text = PlayerPrefs.GetString("varName", "if nothing found this text return");

PlayerPrefs.SetFloat
PlayerPrefs.SetInt

PlayerPrefs.GetFloat
PlayerPrefs.GetInt
Posted by: Guest on April-27-2022

C# Answers by Framework

Browse Popular Code Answers by Language