Skip to content

Instantly share code, notes, and snippets.

@nirleka
Last active November 23, 2015 16:14
Show Gist options
  • Save nirleka/4c21087697d57140b908 to your computer and use it in GitHub Desktop.
Save nirleka/4c21087697d57140b908 to your computer and use it in GitHub Desktop.
Unity Vexe framework Fast Save to File Example
using System;
using UnityEngine;
using Vexe.FastSave;
using Vexe.Runtime.Types;
namespace FSExamples
{
public class GameObjectTest : BaseBehaviour
{
public GameObject target;
[HideInInspector]
public string output;
[Show] void SaveGo()
{
output = Save.GameObjectToMemory(target).GetString();
}
[Show] void LoadIntoNewGo()
{
Load.GameObjectFromMemory(output.GetBytes(), new GameObject());
}
[Show] void LoadIntoTargetGo()
{
target.LoadFromMemory(output.GetBytes());
}
[Show] void SaveToFile()
{
Save.GameObjectToFile(
//akan disimpan di Assets/dst...
//http://docs.unity3d.com/ScriptReference/Application-dataPath.html
//perisa script save & load buat liat lbh lanjut.
//ps. file bakal muncul kalo folder di refresh
Application.dataPath + "/VFW Examples/FastSave Examples/Save/test",
target
);
}
[Show] void LoadFromFile()
{
Load.GameObjectFromFile(
//akan disimpan di Assets/dst...
Application.dataPath + "/VFW Examples/FastSave Examples/Save/test",
target
);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment