C# Class TextSceneDeserializer, UnityTextScene

Class reading and populating a scene based on text-based scene files.
Datei anzeigen Open project: terravision/UnityTextScene Class Usage Examples

Public Methods

Method Description
Load ( string path ) : string

Loads a new scene from path. Path is absolute.

Load ( string path, TempSceneSaved callback ) : string
Load ( ) : void

Loads a TextScene into a clean scene. Will ask user for path.

LoadAdditive ( TextAsset asset, GameObject parent ) : void

Additively loads a TextScene. All objects from the TextScene will be children of the passed parent, if any. The TextScene will be added with a link to its original source asset, so it can easily be treated as a prefab, or scene-in-scene link.

LoadContext ( ) : void

Loads the currently selected TextScene. Will fail and notify user if the selected file is not a text file.

LoadNewScene ( string path ) : string
LoadNewScene ( string path, TempSceneSaved callback ) : string
LoadSafe ( string path ) : string
LoadScene ( string path ) : bool

Loads objects from TextScene file into the currently open scene.

Private Methods

Method Description
AssignValue ( object comp, string fieldType, string fieldName, object parameter ) : void
ConvertFloat ( string s ) : float
Deserialize ( StreamReader stream, GameObject parent ) : void

Main function for deserializing the scene from file.

DeserializeGameObject ( StreamReader stream, string name, GameObject parent ) : void
DeserializePrefab ( StreamReader stream, string name, GameObject parent ) : void
DeserializeTextScene ( StreamReader stream, string name, GameObject parent ) : void
DeserializeTransform ( StreamReader stream, Transform transform ) : void
ProcessLine ( StreamReader stream, string line, GameObject parent ) : void
ProcessValueLine ( StreamReader stream, string name, object obj ) : bool
ReadComponentValue ( StreamReader stream, string fieldEditorType, string fieldObjectType, string fieldValue, object &parameter ) : bool
SetupBuiltinMeshes ( ) : void

Instantiates and destroys the built-in primitives so we can get a reference to their meshes. FIXME: It would be a lot better if we could get these mesh references in a less hack-ish way!

TextSceneDeserializer ( ) : System.Collections.Generic
TextSceneDeserializer ( GameObject container ) : System.Collections.Generic
TextSceneDeserializer ( GameObject container, string recursionGuard ) : System.Collections.Generic

Method Details

Load() public static method

Loads a new scene from path. Path is absolute.
public static Load ( string path ) : string
path string
return string

Load() public static method

public static Load ( string path, TempSceneSaved callback ) : string
path string
callback TempSceneSaved
return string

Load() public static method

Loads a TextScene into a clean scene. Will ask user for path.
public static Load ( ) : void
return void

LoadAdditive() public static method

Additively loads a TextScene. All objects from the TextScene will be children of the passed parent, if any. The TextScene will be added with a link to its original source asset, so it can easily be treated as a prefab, or scene-in-scene link.
public static LoadAdditive ( TextAsset asset, GameObject parent ) : void
asset UnityEngine.TextAsset
parent GameObject
return void

LoadContext() public static method

Loads the currently selected TextScene. Will fail and notify user if the selected file is not a text file.
public static LoadContext ( ) : void
return void

LoadNewScene() public method

public LoadNewScene ( string path ) : string
path string
return string

LoadNewScene() public method

public LoadNewScene ( string path, TempSceneSaved callback ) : string
path string
callback TempSceneSaved
return string

LoadSafe() public static method

public static LoadSafe ( string path ) : string
path string
return string

LoadScene() public method

Loads objects from TextScene file into the currently open scene.
public LoadScene ( string path ) : bool
path string
return bool