public override void WriteProperties(JsonObjectContract contract, JsonWriter writer, object value, Type objectType, JsonSerializerWriter internalWriter) { var instance = (UnityEngine.MeshFilter)value; internalWriter.SerializeProperty(writer, "sharedMesh", instance.sharedMesh); internalWriter.SerializeProperty(writer, "hideFlags", instance.hideFlags); }
public override void WriteProperties(JsonObjectContract contract, JsonWriter writer, object value, Type objectType, JsonSerializerWriter internalWriter) { var instance = (UnityEngine.Transform)value; internalWriter.SerializeProperty(writer, "parent", instance.parent); internalWriter.SerializeProperty(writer, "position", instance.position); internalWriter.SerializeProperty(writer, "rotation", instance.rotation); internalWriter.SerializeProperty(writer, "localScale", instance.localScale); internalWriter.SerializeProperty(writer, "hideFlags", instance.hideFlags); }
public override void WriteProperties(JsonObjectContract contract, JsonWriter writer, object value, Type objectType, JsonSerializerWriter internalWriter) { var instance = (UnityEngine.Sprite)value; internalWriter.SerializeProperty(writer, "texture", instance.texture); internalWriter.SerializeProperty(writer, "textureRect", instance.textureRect); internalWriter.SerializeProperty(writer, "pivot", instance.pivot); writer.WriteProperty("pixelsPerUnit", instance.pixelsPerUnit); internalWriter.SerializeProperty(writer, "border", instance.border); writer.WriteProperty("name", instance.name); internalWriter.SerializeProperty(writer, "hideFlags", instance.hideFlags); }
public override void WriteProperties(JsonObjectContract contract, JsonWriter writer, object value, Type objectType, JsonSerializerWriter internalWriter) { var instance = (UnityEngine.AudioClip)value; float[] samples = new float[instance.samples * instance.channels]; instance.GetData(samples, 0); writer.WriteProperty("name", instance.name); writer.WriteProperty("lengthSamples", instance.samples); writer.WriteProperty("channels", instance.channels); writer.WriteProperty("frequency", instance.frequency); internalWriter.SerializeProperty(writer, "hideFlags", instance.hideFlags); internalWriter.SerializeProperty(writer, "sampleData", samples); }
public override void WriteProperties(JsonObjectContract contract, JsonWriter writer, object value, Type objectType, JsonSerializerWriter internalWriter) { Texture2D instance = (Texture2D)value; writer.WriteProperty("width", instance.width); writer.WriteProperty("height", instance.height); internalWriter.SerializeProperty(writer, "format", instance.format); writer.WriteProperty("mipmapCount", instance.mipmapCount); writer.WriteProperty("mipMapBias", instance.mipMapBias); writer.WriteProperty("anisoLevel", instance.anisoLevel); internalWriter.SerializeProperty(writer, "filterMode", instance.filterMode); internalWriter.SerializeProperty(writer, "wrapMode", instance.wrapMode); writer.WriteProperty("rawTextureData", instance.GetRawTextureData()); }
public override void WriteProperties(JsonObjectContract contract, JsonWriter writer, object value, Type objectType, JsonSerializerWriter internalWriter) { if (objectType == typeof(Bounds)) { Bounds bounds = (Bounds)value; internalWriter.SerializeProperty(writer, "center", bounds.center); internalWriter.SerializeProperty(writer, "size", bounds.size); } else if (objectType == typeof(BoundsInt)) { BoundsInt bounds = (BoundsInt)value; internalWriter.SerializeProperty(writer, "position", bounds.position); internalWriter.SerializeProperty(writer, "size", bounds.size); } }
public override void WriteProperties(JsonObjectContract contract, JsonWriter writer, object value, Type objectType, JsonSerializerWriter internalWriter) { if (objectType == typeof(Rect)) { var rect = (Rect)value; internalWriter.SerializeProperty(writer, "position", rect.position); internalWriter.SerializeProperty(writer, "size", rect.size); } #if UNITY_2017_2_OR_NEWER else if (objectType == typeof(Vector2Int)) { var rect = (RectInt)value; internalWriter.SerializeProperty(writer, "position", rect.position); internalWriter.SerializeProperty(writer, "size", rect.size); } #endif }
public override void WriteProperties(JsonObjectContract contract, JsonWriter writer, object value, Type objectType, JsonSerializerWriter internalWriter) { var instance = (UnityEngine.Collider)value; writer.WriteProperty("isTrigger", instance.isTrigger); writer.WriteProperty("contactOffset", instance.contactOffset); internalWriter.SerializeProperty(writer, "sharedMaterial", instance.sharedMaterial); internalWriter.SerializeObjectProperties(writer, value, contract, null, null, null, this.propertiesToIgnore.ToArray()); }
public override void WriteProperties(JsonObjectContract contract, JsonWriter writer, object value, Type objectType, JsonSerializerWriter internalWriter) { Material material = (Material)value; internalWriter.SerializeProperty(writer, "shader", material.shader); writer.WriteProperty("name", material.name); internalWriter.SerializeProperty(writer, "shaderKeywords", material.shaderKeywords); writer.WriteProperty("renderQueue", material.renderQueue); writer.WriteProperty("globalIlluminationFlags", material.globalIlluminationFlags); writer.WriteProperty("doubleSidedGI", material.doubleSidedGI); writer.WriteProperty("enableInstancing", material.enableInstancing); RuntimeMaterialProperties properties = MaterialPropertiesResolver.Current.GetMaterialProperties(material); if (properties != null) { List <JsonSerializedMaterialProperty> serializableProperties = new List <JsonSerializedMaterialProperty>(); for (int i = 0; i < properties.Properties.Count; i++) { RuntimeMaterialProperty property = properties.Properties[i]; JsonSerializedMaterialProperty serializedProperty = new JsonSerializedMaterialProperty(); serializedProperty.name = property.Name; serializedProperty.type = property.Type; switch (property.Type) { case RuntimeMaterialPropertyType.Color: serializedProperty.value = material.GetColor(property.Name); break; case RuntimeMaterialPropertyType.Vector: serializedProperty.value = material.GetVector(property.Name); break; case RuntimeMaterialPropertyType.Float: serializedProperty.value = material.GetFloat(property.Name); break; case RuntimeMaterialPropertyType.Range: serializedProperty.value = material.GetFloat(property.Name); break; case RuntimeMaterialPropertyType.Texture: serializedProperty.value = material.GetTexture(property.Name); break; } serializableProperties.Add(serializedProperty); //internalWriter.SerializeProperty(writer, MaterialPropertyNamePrefix + property.Name, serializedProperty); } internalWriter.SerializeProperty(writer, MaterialPropertiesName, serializableProperties); } // Serialize main properties when there are no pre-defined properties available for this material else { internalWriter.SerializeProperty(writer, "color", material.color); internalWriter.SerializeProperty(writer, "mainTexture", material.mainTexture); internalWriter.SerializeProperty(writer, "mainTextureOffset", material.mainTextureOffset); internalWriter.SerializeProperty(writer, "mainTextureScale", material.mainTextureScale); } }
public override void WriteProperties(JsonObjectContract contract, JsonWriter writer, object value, Type objectType, JsonSerializerWriter internalWriter) { var instance = (UnityEngine.Mesh)value; #if UNITY_2017_3 internalWriter.SerializeProperty(writer, "indexFormat", instance.indexFormat); #endif internalWriter.SerializeProperty(writer, "bindposes", instance.bindposes); writer.WriteProperty("subMeshCount", instance.subMeshCount); internalWriter.SerializeProperty(writer, "bounds", instance.bounds); internalWriter.SerializeProperty(writer, "vertices", instance.vertices); internalWriter.SerializeProperty(writer, "normals", instance.normals); internalWriter.SerializeProperty(writer, "tangents", instance.tangents); internalWriter.SerializeProperty(writer, "uv", instance.uv); internalWriter.SerializeProperty(writer, "uv2", instance.uv2); internalWriter.SerializeProperty(writer, "uv3", instance.uv3); internalWriter.SerializeProperty(writer, "uv4", instance.uv4); internalWriter.SerializeProperty(writer, "colors", instance.colors); internalWriter.SerializeProperty(writer, "colors32", instance.colors32); writer.WritePropertyName("triangles"); writer.WriteStartArray(); for (int i = 0; i < instance.subMeshCount; i++) { internalWriter.Serialize(writer, instance.GetTriangles(i)); } writer.WriteEndArray(); writer.WritePropertyName("indices"); writer.WriteStartArray(); for (int i = 0; i < instance.subMeshCount; i++) { SerializedIndices serializedIndices = new SerializedIndices(); serializedIndices.meshTopology = instance.GetTopology(i); serializedIndices.indices = instance.GetIndices(i); internalWriter.Serialize(writer, serializedIndices); } writer.WriteEndArray(); internalWriter.SerializeProperty(writer, "boneWeights", instance.boneWeights); writer.WriteProperty("name", instance.name); internalWriter.SerializeProperty(writer, "hideFlags", instance.hideFlags); }
public override void WriteProperties(JsonObjectContract contract, JsonWriter writer, object value, Type objectType, JsonSerializerWriter internalWriter) { var instance = (UnityEngine.RectTransform)value; internalWriter.SerializeProperty(writer, "anchorMin", instance.anchorMin); internalWriter.SerializeProperty(writer, "anchorMax", instance.anchorMax); internalWriter.SerializeProperty(writer, "anchoredPosition", instance.anchoredPosition); internalWriter.SerializeProperty(writer, "sizeDelta", instance.sizeDelta); internalWriter.SerializeProperty(writer, "pivot", instance.pivot); internalWriter.SerializeProperty(writer, "offsetMin", instance.offsetMin); internalWriter.SerializeProperty(writer, "offsetMax", instance.offsetMax); internalWriter.SerializeProperty(writer, "position", instance.position); internalWriter.SerializeProperty(writer, "rotation", instance.rotation); internalWriter.SerializeProperty(writer, "localScale", instance.localScale); internalWriter.SerializeProperty(writer, "parent", instance.parent); internalWriter.SerializeProperty(writer, "hideFlags", instance.hideFlags); }
public virtual void WriteObjectProperties(JsonWriter writer, Renderer instance, JsonSerializerWriter internalWriter) { internalWriter.SerializeProperty(writer, "sharedMaterials", instance.sharedMaterials); }