/// <summary>
        ///
        /// </summary>
        /// <param name="binaryReader"></param>
        public override void Deserialize(BinaryReader binaryReader)
        {
            base.Deserialize(binaryReader);

#if UNITY_2019_1_OR_NEWER
            m_forceRenderingOff = binaryReader.ReadBoolean();
            m_rayTracingMode    = (UnityEngine.Experimental.Rendering.RayTracingMode)binaryReader.ReadInt32();
#endif
            m_lightProbeUsage            = (UnityEngine.Rendering.LightProbeUsage)binaryReader.ReadInt32();
            m_motionVectorGenerationMode = (MotionVectorGenerationMode)binaryReader.ReadInt32();
            m_reflectionProbeUsage       = (UnityEngine.Rendering.ReflectionProbeUsage)binaryReader.ReadInt32();
            m_shadowCastingMode          = (UnityEngine.Rendering.ShadowCastingMode)binaryReader.ReadInt32();
            m_lightmapIndex                 = binaryReader.ReadInt32();
            m_rendererPriority              = binaryReader.ReadInt32();
            m_realtimeLightmapIndex         = binaryReader.ReadInt32();
            m_sortingLayerID                = binaryReader.ReadInt32();
            m_sortingOrder                  = binaryReader.ReadInt32();
            m_renderingLayerMask            = binaryReader.ReadUInt32();
            m_lightProbeProxyVolumeOverride = binaryReader.ReadString();
            m_sortingLayerName              = binaryReader.ReadString();
            m_receiveShadows                = binaryReader.ReadBoolean();
            m_allowOcclusionWhenDynamic     = binaryReader.ReadBoolean();
            m_enabled             = binaryReader.ReadBoolean();
            m_isPartOfStaticBatch = binaryReader.ReadBoolean();
            m_isVisible           = binaryReader.ReadBoolean();
            m_bounds                      = SerializerKun.DesirializeObject <BoundsKun>(binaryReader);
            m_probeAnchor                 = SerializerKun.DesirializeObject <TransformKun>(binaryReader);
            m_lightmapScaleOffset         = SerializerKun.DesirializeObject <Vector4Kun>(binaryReader);
            m_realtimeLightmapScaleOffset = SerializerKun.DesirializeObject <Vector4Kun>(binaryReader);
            m_localToWorldMatrix          = SerializerKun.DesirializeObject <Matrix4x4Kun>(binaryReader);
            m_worldToLocalMatrix          = SerializerKun.DesirializeObject <Matrix4x4Kun>(binaryReader);
            m_material                    = SerializerKun.DesirializeObject <MaterialKun>(binaryReader);
            m_sharedMaterial              = SerializerKun.DesirializeObject <MaterialKun>(binaryReader);
            m_materials                   = SerializerKun.DesirializeObjects <MaterialKun>(binaryReader);
            m_sharedMaterials             = SerializerKun.DesirializeObjects <MaterialKun>(binaryReader);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            var other = obj as RendererKun;

            if (other == null)
            {
                return(false);
            }

#if UNITY_2019_1_OR_NEWER
            if (!m_forceRenderingOff.Equals(other.m_forceRenderingOff))
            {
                return(false);
            }
            if (!m_rayTracingMode.Equals(other.m_rayTracingMode))
            {
                return(false);
            }
#endif
            if (!m_allowOcclusionWhenDynamic.Equals(other.m_allowOcclusionWhenDynamic))
            {
                return(false);
            }
            if (m_bounds != null && !m_bounds.Equals(other.m_bounds))
            {
                return(false);
            }
            if (!m_enabled.Equals(other.m_enabled))
            {
                return(false);
            }
            if (!m_isPartOfStaticBatch.Equals(other.m_isPartOfStaticBatch))
            {
                return(false);
            }
            if (!m_isVisible.Equals(other.m_isVisible))
            {
                return(false);
            }
            if (!m_lightmapIndex.Equals(other.m_lightmapIndex))
            {
                return(false);
            }
            if (m_lightmapScaleOffset != null && !m_lightmapIndex.Equals(other.m_lightmapIndex))
            {
                return(false);
            }
            if (m_lightProbeProxyVolumeOverride != null && !m_lightProbeProxyVolumeOverride.Equals(other.m_lightProbeProxyVolumeOverride))
            {
                return(false);
            }
            if (!m_lightProbeUsage.Equals(other.m_lightProbeUsage))
            {
                return(false);
            }

            if (m_localToWorldMatrix != null && !m_localToWorldMatrix.Equals(other.m_localToWorldMatrix))
            {
                return(false);
            }

            if (m_material != null && !m_material.Equals(other.m_material))
            {
                return(false);
            }

            if (m_materials != null)
            {
                if (m_materials.Length != other.m_materials.Length)
                {
                    return(false);
                }
                for (var i = 0; i < m_materials.Length; i++)
                {
                    if (!m_materials[i].Equals(other.m_materials[i]))
                    {
                        return(false);
                    }
                }
            }

            if (!m_motionVectorGenerationMode.Equals(other.m_motionVectorGenerationMode))
            {
                return(false);
            }

            if (m_probeAnchor != null && !m_probeAnchor.Equals(other.m_probeAnchor))
            {
                return(false);
            }

            if (!m_realtimeLightmapIndex.Equals(other.m_realtimeLightmapIndex))
            {
                return(false);
            }

            if (m_realtimeLightmapScaleOffset != null && !m_realtimeLightmapScaleOffset.Equals(other.m_realtimeLightmapScaleOffset))
            {
                return(false);
            }

            if (!m_receiveShadows.Equals(other.m_receiveShadows))
            {
                return(false);
            }

            if (!m_reflectionProbeUsage.Equals(other.m_reflectionProbeUsage))
            {
                return(false);
            }

            if (!m_rendererPriority.Equals(other.m_rendererPriority))
            {
                return(false);
            }

            if (!m_renderingLayerMask.Equals(other.m_renderingLayerMask))
            {
                return(false);
            }

            if (!m_shadowCastingMode.Equals(other.m_shadowCastingMode))
            {
                return(false);
            }

            if (!MaterialKun.Equals(m_sharedMaterial, other.m_sharedMaterial))
            {
                return(false);
            }

            if (m_sharedMaterials != null)
            {
                if (!m_sharedMaterials.Length.Equals(other.m_sharedMaterials.Length))
                {
                    return(false);
                }
                for (var i = 0; i < m_sharedMaterials.Length; i++)
                {
                    if (!m_sharedMaterials[i].Equals(other.m_sharedMaterials[i]))
                    {
                        return(false);
                    }
                }
            }

            if (!m_sortingLayerID.Equals(other.m_sortingLayerID))
            {
                return(false);
            }

            if (!string.Equals(m_sortingLayerName, other.m_sortingLayerName))
            {
                return(false);
            }
            if (!m_sortingOrder.Equals(other.m_sortingOrder))
            {
                return(false);
            }
            if (!Matrix4x4Kun.Equals(m_worldToLocalMatrix, other.m_worldToLocalMatrix))
            {
                return(false);
            }

            return(base.Equals(obj));
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="component"></param>
        public RendererKun(Component component) : base(component)
        {
            componentKunType                = ComponentKunType.Renderer;
            m_bounds                        = new BoundsKun();
            m_lightmapScaleOffset           = new Vector4Kun();
            m_lightProbeProxyVolumeOverride = "";
            m_localToWorldMatrix            = new Matrix4x4Kun();
            m_probeAnchor                   = new TransformKun();
            m_realtimeLightmapScaleOffset   = new Vector4Kun();
            m_worldToLocalMatrix            = new Matrix4x4Kun();

            m_sortingLayerName = "";


            var renderer = component as Renderer;

            if (renderer)
            {
                #if UNITY_2019_1_OR_NEWER
                forceRenderingOff = renderer.forceRenderingOff;
                rayTracingMode    = renderer.rayTracingMode;
                #endif

                allowOcclusionWhenDynamic = renderer.allowOcclusionWhenDynamic;
                bounds  = renderer.bounds;
                enabled = renderer.enabled;

                isPartOfStaticBatch = renderer.isPartOfStaticBatch;
                isVisible           = renderer.isVisible;
                lightmapIndex       = renderer.lightmapIndex;
                lightmapScaleOffset = renderer.lightmapScaleOffset;
                if (renderer.lightProbeProxyVolumeOverride)
                {
                    lightProbeProxyVolumeOverride = renderer.lightProbeProxyVolumeOverride.ToString();
                }
                lightProbeUsage    = renderer.lightProbeUsage;
                localToWorldMatrix = renderer.localToWorldMatrix;
#if !UNITY_EDITOR
                if (renderer.material != null)
                {
                    material = new MaterialKun(renderer.material);
                }

                if (renderer.materials != null)
                {
                    materials = new MaterialKun[renderer.materials.Length];
                    for (var i = 0; i < renderer.materials.Length; i++)
                    {
                        materials[i] = new MaterialKun(renderer.materials[i]);
                    }
                }
#endif
                motionVectorGenerationMode = renderer.motionVectorGenerationMode;
                if (renderer.probeAnchor != null)
                {
                    probeAnchor = new TransformKun(renderer.probeAnchor);
                }

                realtimeLightmapIndex       = renderer.realtimeLightmapIndex;
                realtimeLightmapScaleOffset = renderer.realtimeLightmapScaleOffset;
                rendererPriority            = renderer.rendererPriority;
                renderingLayerMask          = renderer.renderingLayerMask;
                shadowCastingMode           = renderer.shadowCastingMode;
                sharedMaterial = new MaterialKun(renderer.sharedMaterial);
                if (renderer.sharedMaterials != null)
                {
                    sharedMaterials = new MaterialKun[renderer.sharedMaterials.Length];
                    for (var i = 0; i < renderer.sharedMaterials.Length; i++)
                    {
                        sharedMaterials[i] = new MaterialKun(renderer.sharedMaterials[i]);
                    }
                }
                sortingLayerID     = renderer.sortingLayerID;
                sortingLayerName   = renderer.sortingLayerName;
                sortingOrder       = renderer.sortingOrder;
                worldToLocalMatrix = renderer.worldToLocalMatrix;
            }
        }