public override bool WriteToJson(GameObject obj, Component component, MyJson_Object compJson)
        {
            SkinnedMeshRenderer comp = component as SkinnedMeshRenderer;

            compJson.SetBool("_castShadows", comp.shadowCastingMode != UnityEngine.Rendering.ShadowCastingMode.Off);
            compJson.SetBool("_receiveShadows", comp.receiveShadows);
            compJson.SetMesh(obj, comp.sharedMesh);
            compJson.SetMaterials(obj, comp.sharedMaterials, false, true);

            return(true);
        }
Exemple #2
0
        public override bool WriteToJson(GameObject obj, Component component, MyJson_Object compJson)
        {
            MeshRenderer comp = component as MeshRenderer;

            compJson.SetInt("_lightmapIndex", comp.lightmapIndex);
            compJson.SetBool("_castShadows", comp.shadowCastingMode != UnityEngine.Rendering.ShadowCastingMode.Off);
            compJson.SetBool("_receiveShadows", comp.receiveShadows);
            compJson.SetVector4("_lightmapScaleOffset", comp.lightmapScaleOffset, 8);
            compJson.SetMaterials(obj, comp.sharedMaterials);

            return(true);
        }
Exemple #3
0
        public override bool WriteToJson(GameObject _object, Component component, MyJson_Object compJson)
        {
            ParticleSystemRenderer comp = component as ParticleSystemRenderer;
            ParticleSystem         c    = _object.GetComponent <ParticleSystem>();

            if (c == null || !c.emission.enabled)
            {
                MyLog.LogWarning("无效的粒子组件:" + _object.name);
                return(false);
            }
            compJson.SetNumber("velocityScale", comp.velocityScale);
            compJson.SetNumber("lengthScale", comp.lengthScale);
            compJson.SetEnum("_renderMode", comp.renderMode);
            if (comp.renderMode == ParticleSystemRenderMode.Mesh && comp.mesh == null)
            {
                throw new Exception(_object.name + ": mesh 丢失");
            }
            //Mesh
            compJson.SetMesh(_object, comp.mesh);
            //Material粒子系统不支持多材质
            compJson.SetMaterials(_object, new Material[] { comp.sharedMaterial }, true);
            return(true);
        }