protected override void Awake()
        {
            base.Awake ();

            // Create new sample
            SerializationTarget		= CreateNewSampleInstance();
        }
        protected override void OnGUIWindow()
        {
            base.OnGUIWindow();

            RootScrollView.BeginScrollView();
            {
                // Start vertical column
                GUILayout.BeginVertical(UISkin.scrollView);
                {
                    if (GUILayout.Button("Create New Instance (Demo Purpose)"))
                    {
                        SerializationTarget		= CreateNewSampleInstance();
                    }

                    if (GUILayout.Button("Assign Random Value (Demo Purpose)"))
                    {
                        // Assign random value
                        if (SerializationTarget != null)
                            SerializationTarget.AssignRandomValue();

                        PrintObject(SerializationTarget, true);
                    }

                    if (GUILayout.Button("Print Object Value"))
                    {
                        PrintObject(SerializationTarget, true);
                    }

                    GUILayout.Label("Save Target : None",kSubTitleStyle);
                    GUILayout.BeginHorizontal();
                    {
                        if (GUILayout.Button("Serialize"))
                        {
                            SerializeWithNoSave();
                        }

                        if (GUILayout.Button("Deserialize"))
                        {
                            DeserializeWithNoSave();
                        }
                    }
                    GUILayout.EndHorizontal();

                    GUILayout.Label("Save Target : Player Preferences",kSubTitleStyle);
                    GUILayout.BeginHorizontal();
                    {
                        if (GUILayout.Button("Serialize"))
                        {
                            SerializeToPlayerPrefs();
                        }

                        if (GUILayout.Button("Deserialize"))
                        {
                            DeserializeFromPlayerPrefs();
                        }
                    }
                    GUILayout.EndHorizontal();

            #if !(UNITY_WEBPLAYER || UNITY_WEBGL)

                    GUILayout.Label("Save Target : File",kSubTitleStyle);
                    GUILayout.BeginHorizontal();
                    {
                        if (GUILayout.Button("Serialize"))
                        {
                            SerializeToFile();
                        }

                        if (GUILayout.Button("Deserialize"))
                        {
                            DeserializeFromFile();
                        }
                    }
                    GUILayout.EndHorizontal();
            #else

                    GUI.enabled = false;
                    GUILayout.Label("Save Target : File [Disabled - File access off on Web]",kSubTitleStyle);
                    GUI.enabled = true;

            #endif

                    GUILayout.Label("Misc",kSubTitleStyle);
                    GUILayout.BeginVertical();
                    {
                        if (GUILayout.Button("Get Serialization Data From Player Preferences"))
                        {
                            GetSerializationDataFromPlayerPrefs();
                        }

            #if !(UNITY_WEBPLAYER || UNITY_WEBGL)
                        if (GUILayout.Button("Get Serialization Data From File"))
                        {
                            GetSerializationDataFromFile();
                        }
            #endif

                        if (GUILayout.Button("Save"))
                        {
                            SaveSerializationData();
                        }
                    }
                    GUILayout.EndVertical();
                }
                GUILayout.EndVertical();
            }
            RootScrollView.EndScrollView();

            DrawResults();

            DrawPopButton();
        }
 private void DeserializeFromFile()
 {
     // As 2nd parameter "_targetObject" isnt specified, object of new instance is created on deserialization
     // If "_targetObject" was specified then deserialized value would be assigned to the target instance
     SerializationTarget = RSManager.Deserialize<SerializationSample>(Save2FileSerializationID);
 }
        private void DeserializeWithNoSave()
        {
            // Note: We havent registered for callbacks, so once deserialization is completed we are updating status of it
            SerializationTarget	= RSManager.DeserializeData<SerializationSample>(SerializationData);

            // Updating deserialization status
            AddNewResult("Deserialization finished");

            // Print deserialized value
            PrintObject(SerializationTarget, false);
        }