Ignition / PlayerData

´╗┐Namespace Playniax.Ignition

Class or component can be found in Assets/Playniax/Framework/Ignition/Framework/Scripts/PlayerData.cs

Class PlayerData

Description

PlayerData can be used to temporarily store data of the game like lives, name or score of the player.

lives, name of score are built-in data fields.

Custom fields can be added to custom and supports floats, integers, booleans and strings.

This information will not be saved and is only avaiable at runtime.

Example(s):

Set name of the player : PlayerData.Get(0).name = "Tony"

Increase the score of the player : PlayerData.Get(0).scoreboard += 100;

Custom variable : PlayerData.Get(0).custom.SetBool("invincible", true);

Public fieldsDescription
Config custom = new Config()Custom data storage.

Public MethodsDescription
static PlayerData Get(int index = 0)Returns the PlayerData for the player by index.
static PlayerData Get(string name)Returns the PlayerData for the player by name.
static void Reset(int lives)Reset to defaults
static void SetLives(int lives)Set number of lives