- Home /
Duplicate Question
When I Enter the script and hit Create it gives me an error
When I insert this script:
PlayerPrefs.SetInt(((VitalName)cnt).ToString() +" - Base Value" ,pcClass.GetVital(cnt).BaseValue);
I have asked many people and it only occurs on Windows 7 64-bits
The error I get When I press Create Button is:
NullReferenceException: Object reference not set to an instance of an object GameSettings.SaveCharacterData () (at Assets/Standard Assets/C# scripts/Character statistics/GameSettings.cs:32) CharacterGenerator.DisplayCreateButton () (at Assets/Standard Assets/C# scripts/Character statistics/CharacterGenerator.cs:148) CharacterGenerator.OnGUI () (at Assets/Standard Assets/C# scripts/Character statistics/CharacterGenerator.cs:56)
I think it has something to do with the vital script it is:
public class Vital : ModifiedStat {
private int _curValue;
public Vital(){
_curValue = 0;
ExpToLevel = 40;
LevelModifier = 1.1f;
}
public int CurValue{
get{
if(_curValue > AddjustedBaseValue)
_curValue = AddjustedBaseValue;
return _curValue;
}
set{_curValue = value;}
}
}
public enum VitalName {
Energy,
Mana,
Health
}
Both the scripts are in C# Can someone help me? please
Follow this Question
Related Questions
"NullReferenceException: Object reference not set to an instance of an object" Error 0 Answers
GUILayout Window Help 1 Answer
What Am I doing wrong? 1 Answer
Adding a texture to array textures?! 1 Answer
UNEXPECTED TOKEN ) PLEASE HELP ME ;( 1 Answer