Files
AR-Menu/Library/PackageCache/org.khronos.unitygltf@6b55d14e19c1/Runtime/Plugins/GLTFSerialization/Schema/GLTFChildOfRootProperty.cs
2025-11-30 08:35:03 +02:00

51 lines
1.1 KiB
C#

using Newtonsoft.Json;
namespace GLTF.Schema
{
public class GLTFChildOfRootProperty : GLTFProperty
{
/// <summary>
/// The user-defined name of this object.
/// This is not necessarily unique, e.g., an accessor and a buffer could have the same name,
/// or two accessors could even have the same name.
/// </summary>
public string Name;
public GLTFChildOfRootProperty()
{
}
public GLTFChildOfRootProperty(GLTFChildOfRootProperty childOfRootProperty, GLTFRoot gltfRoot) : base(childOfRootProperty, gltfRoot)
{
if (childOfRootProperty == null) return;
Name = childOfRootProperty.Name;
}
public new void DefaultPropertyDeserializer(GLTFRoot root, JsonReader reader)
{
switch (reader.Value.ToString())
{
case "name":
Name = reader.ReadAsString();
break;
default:
base.DefaultPropertyDeserializer(root, reader);
break;
}
}
public override void Serialize(JsonWriter writer)
{
if (Name != null)
{
writer.WritePropertyName("name");
writer.WriteValue(Name);
}
base.Serialize(writer);
}
}
}