mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Serialize Data
This commit is contained in:
@@ -529,6 +529,37 @@ static class ScriptGlue
|
||||
return ScriptEngine.ApplicationInfo.IsInPlayMode;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Serialization
|
||||
|
||||
[RegisterCall("ScriptGlue::Serialization_SerializeField")]
|
||||
static void Serialization_SerializeField(void* serializationContext, SerializationType type, MonoString* nameObject, MonoObject* valueObject)
|
||||
{
|
||||
SerializedObject context = Internal.UnsafeCastToObject(serializationContext) as SerializedObject;
|
||||
|
||||
Log.EngineLogger.AssertDebug(context != null);
|
||||
|
||||
char8* name = Mono.mono_string_to_utf8(nameObject);
|
||||
|
||||
context.AddField(StringView(name), type, valueObject);
|
||||
|
||||
Mono.mono_free(name);
|
||||
}
|
||||
|
||||
[RegisterCall("ScriptGlue::Serialization_CreateObject")]
|
||||
static void Serialization_CreateObject(void* currentContext, out void* newContext, out UUID newId)
|
||||
{
|
||||
SerializedObject context = Internal.UnsafeCastToObject(currentContext) as SerializedObject;
|
||||
|
||||
Log.EngineLogger.AssertDebug(context != null);
|
||||
|
||||
SerializedObject newObject = new SerializedObject(context.AllObjects);
|
||||
|
||||
newContext = Internal.UnsafeCastToPtr(newObject);
|
||||
newId = newObject.Id;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private static void RegisterCall<T>(String name, T method) where T : var
|
||||
|
||||
Reference in New Issue
Block a user