SaveGame.Load

Description

Load the data from the specified identifier.

Please note, if the type is a Component or Reference Type, then it will be instantiated without your knowledge, so, we recommend you to use SaveGame.LoadInto for loading Components and Reference Types.

Parameters

Name Type Description Required
identifier string The identifier required
type or T Type The type of data to load required
defaultValue object The default value to return when the specified data does not exists optional
settings SaveGameSettings The optional settings optional

Returns

The loaded data if exists, otherwise returns the default value specified, else returns null.

Examples

Loading Simple Data

// Loading by Generic
string simple = SaveGame.Load<string> ( "simple.txt", "The Default Value" );

// Loading by Type
string simple = ( string )SaveGame.Load ( "simple.txt", typeof ( string ), "The Default Value" );

Loading Array

// Loading by Generic
string[] names = SaveGame.Load<string[]> ( "names.txt" );

// Loading by Type
string[] names = ( string[] )SaveGame.Load ( "names.txt", typeof ( string[] ) );

Loading from Folder

string simpleText = SaveGame.Load<string> ( "myFolder/myFile.txt" );