Ejemplo n.º 1
0
        public new ParticleRenderer Clone(AssetCabinet file)
        {
            file.MergeTypeDefinition(this.file, UnityClassID.ParticleRenderer);

            ParticleRenderer partRenderer = new ParticleRenderer(file);

            AssetCabinet.IncompleteClones.Add(new Tuple <Component, Component>(this, partRenderer));
            return(partRenderer);
        }
Ejemplo n.º 2
0
 public void CopyTo(ParticleRenderer dest)
 {
     base.CopyTo(dest);
     dest.m_CameraVelocityScale = m_CameraVelocityScale;
     dest.m_StretchParticles    = m_StretchParticles;
     dest.m_LengthScale         = m_LengthScale;
     dest.m_VelocityScale       = m_VelocityScale;
     dest.m_MaxParticleSize     = m_MaxParticleSize;
     dest.UV_Animation.x_Tile   = UV_Animation.x_Tile;
     dest.UV_Animation.y_Tile   = UV_Animation.y_Tile;
     dest.UV_Animation.cycles   = UV_Animation.cycles;
 }
Ejemplo n.º 3
0
 public dynamic LoadComponent(Stream stream, int index, NotLoaded comp)
 {
     stream.Position = comp.offset;
     try
     {
         switch (comp.classID1)
         {
         case UnityClassID.AnimationClip:
             {
                 AnimationClip animationClip = new AnimationClip(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, animationClip, comp);
                 animationClip.LoadFrom(stream);
                 return animationClip;
             }
         case UnityClassID.Animator:
             {
                 Animator animator = new Animator(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, animator, comp);
                 animator.LoadFrom(stream);
                 return animator;
             }
         case UnityClassID.AnimatorController:
             {
                 AnimatorController animatorController = new AnimatorController(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, animatorController, comp);
                 animatorController.LoadFrom(stream);
                 return animatorController;
             }
         case UnityClassID.AssetBundle:
             {
                 AssetBundle assetBundle = new AssetBundle(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, assetBundle, comp);
                 assetBundle.LoadFrom(stream);
                 return assetBundle;
             }
         case UnityClassID.AudioClip:
             {
                 if (loadingReferencials)
                 {
                     return comp;
                 }
                 AudioClip ac = new AudioClip(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, ac, comp);
                 ac.LoadFrom(stream);
                 return ac;
             }
         case UnityClassID.AudioListener:
             {
                 AudioListener audioListener = new AudioListener(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, audioListener, comp);
                 audioListener.LoadFrom(stream);
                 return audioListener;
             }
         case UnityClassID.AudioSource:
             {
                 AudioSource audioSrc = new AudioSource(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, audioSrc, comp);
                 audioSrc.LoadFrom(stream);
                 return audioSrc;
             }
         case UnityClassID.Avatar:
             {
                 if (loadingReferencials)
                 {
                     return comp;
                 }
                 Avatar avatar = new Avatar(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, avatar, comp);
                 avatar.LoadFrom(stream);
                 return avatar;
             }
         case UnityClassID.BoxCollider:
             {
                 BoxCollider boxCol = new BoxCollider(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, boxCol, comp);
                 boxCol.LoadFrom(stream);
                 return boxCol;
             }
         case UnityClassID.Camera:
             {
                 Camera camera = new Camera(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, camera, comp);
                 camera.LoadFrom(stream);
                 return camera;
             }
         case UnityClassID.CapsuleCollider:
             {
                 CapsuleCollider capsuleCol = new CapsuleCollider(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, capsuleCol, comp);
                 capsuleCol.LoadFrom(stream);
                 return capsuleCol;
             }
         case UnityClassID.Cubemap:
             {
                 Cubemap cubemap = new Cubemap(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, cubemap, comp);
                 cubemap.LoadFrom(stream);
                 Parser.Textures.Add(cubemap);
                 return cubemap;
             }
         case UnityClassID.EllipsoidParticleEmitter:
             {
                 EllipsoidParticleEmitter ellipsoid = new EllipsoidParticleEmitter(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, ellipsoid, comp);
                 ellipsoid.LoadFrom(stream);
                 return ellipsoid;
             }
         case UnityClassID.FlareLayer:
             {
                 FlareLayer flareLayer = new FlareLayer(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, flareLayer, comp);
                 flareLayer.LoadFrom(stream);
                 return flareLayer;
             }
         case UnityClassID.Light:
             {
                 Light light = new Light(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, light, comp);
                 light.LoadFrom(stream);
                 return light;
             }
         case UnityClassID.LinkToGameObject:
             {
                 LinkToGameObject link = new LinkToGameObject(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, link, comp);
                 link.LoadFrom(stream);
                 return link;
             }
         case UnityClassID.LinkToGameObject223:
             {
                 LinkToGameObject223 link = new LinkToGameObject223(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, link, comp);
                 link.LoadFrom(stream);
                 return link;
             }
         case UnityClassID.LinkToGameObject225:
             {
                 LinkToGameObject225 link = new LinkToGameObject225(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, link, comp);
                 link.LoadFrom(stream);
                 return link;
             }
         case UnityClassID.GameObject:
             {
                 GameObject gameObj = new GameObject(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, gameObj, comp);
                 gameObj.LoadFrom(stream);
                 return gameObj;
             }
         case UnityClassID.Material:
             {
                 Material mat = new Material(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, mat, comp);
                 mat.LoadFrom(stream);
                 return mat;
             }
         case UnityClassID.Mesh:
             {
                 if (loadingReferencials)
                 {
                     return comp;
                 }
                 Mesh mesh = new Mesh(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, mesh, comp);
                 mesh.LoadFrom(stream);
                 return mesh;
             }
         case UnityClassID.MeshCollider:
             {
                 MeshCollider meshCol = new MeshCollider(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, meshCol, comp);
                 meshCol.LoadFrom(stream);
                 return meshCol;
             }
         case UnityClassID.MeshFilter:
             {
                 MeshFilter meshFilter = new MeshFilter(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, meshFilter, comp);
                 meshFilter.LoadFrom(stream);
                 return meshFilter;
             }
         case UnityClassID.MeshRenderer:
             {
                 MeshRenderer meshRenderer = new MeshRenderer(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, meshRenderer, comp);
                 meshRenderer.LoadFrom(stream);
                 return meshRenderer;
             }
         default:
             if (comp.classID2 == UnityClassID.MonoBehaviour)
             {
                 if (Types.Count > 0)
                 {
                     MonoBehaviour monoBehaviour = new MonoBehaviour(this, comp.pathID, comp.classID1, comp.classID2);
                     ReplaceSubfile(index, monoBehaviour, comp);
                     monoBehaviour.LoadFrom(stream);
                     return monoBehaviour;
                 }
                 else
                 {
                     string message = comp.classID2 + " unhandled because of absence of Types in Cabinet (*.assets)";
                     if (!reported.Contains(message))
                     {
                         Report.ReportLog(message);
                         reported.Add(message);
                     }
                     return comp;
                 }
             }
             else
             {
                 string message = "Unhandled class: " + comp.classID1 + "/" + comp.classID2;
                 if (!reported.Contains(message))
                 {
                     Report.ReportLog(message);
                     reported.Add(message);
                 }
             }
             break;
         case UnityClassID.MonoScript:
             {
                 if (loadingReferencials)
                 {
                     return comp;
                 }
                 MonoScript monoScript = new MonoScript(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, monoScript, comp);
                 monoScript.LoadFrom(stream);
                 return monoScript;
             }
         case UnityClassID.MultiLink:
             {
                 MultiLink multi = new MultiLink(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, multi, comp);
                 multi.LoadFrom(stream);
                 return multi;
             }
         case UnityClassID.ParticleAnimator:
             {
                 ParticleAnimator particleAnimator = new ParticleAnimator(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, particleAnimator, comp);
                 particleAnimator.LoadFrom(stream);
                 return particleAnimator;
             }
         case UnityClassID.ParticleRenderer:
             {
                 ParticleRenderer particleRenderer = new ParticleRenderer(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, particleRenderer, comp);
                 particleRenderer.LoadFrom(stream);
                 return particleRenderer;
             }
         case UnityClassID.ParticleSystem:
             {
                 ParticleSystem particleSystem = new ParticleSystem(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, particleSystem, comp);
                 particleSystem.LoadFrom(stream);
                 return particleSystem;
             }
         case UnityClassID.ParticleSystemRenderer:
             {
                 ParticleSystemRenderer particleSystemRenderer = new ParticleSystemRenderer(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, particleSystemRenderer, comp);
                 particleSystemRenderer.LoadFrom(stream);
                 return particleSystemRenderer;
             }
         case UnityClassID.Projector:
             {
                 Projector projector = new Projector(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, projector, comp);
                 projector.LoadFrom(stream);
                 return projector;
             }
         case UnityClassID.Rigidbody:
             {
                 RigidBody rigidBody = new RigidBody(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, rigidBody, comp);
                 rigidBody.LoadFrom(stream);
                 return rigidBody;
             }
         case UnityClassID.Shader:
             {
                 Shader shader = new Shader(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, shader, comp);
                 shader.LoadFrom(stream);
                 return shader;
             }
         case UnityClassID.SkinnedMeshRenderer:
             {
                 SkinnedMeshRenderer sMesh = new SkinnedMeshRenderer(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, sMesh, comp);
                 sMesh.LoadFrom(stream);
                 return sMesh;
             }
         case UnityClassID.SphereCollider:
             {
                 SphereCollider sphereCol = new SphereCollider(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, sphereCol, comp);
                 sphereCol.LoadFrom(stream);
                 return sphereCol;
             }
         case UnityClassID.Sprite:
             {
                 Sprite sprite = new Sprite(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, sprite, comp);
                 sprite.LoadFrom(stream);
                 return sprite;
             }
         case UnityClassID.SpriteRenderer:
             {
                 SpriteRenderer spriteRenderer = new SpriteRenderer(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, spriteRenderer, comp);
                 spriteRenderer.LoadFrom(stream);
                 return spriteRenderer;
             }
         case UnityClassID.TextAsset:
             {
                 if (loadingReferencials)
                 {
                     return comp;
                 }
                 TextAsset ta = new TextAsset(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, ta, comp);
                 ta.LoadFrom(stream);
                 return ta;
             }
         case UnityClassID.Texture2D:
             {
                 if (loadingReferencials)
                 {
                     return comp;
                 }
                 Texture2D tex = new Texture2D(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, tex, comp);
                 tex.LoadFrom(stream);
                 Parser.Textures.Add(tex);
                 return tex;
             }
         case UnityClassID.Transform:
             {
                 Transform trans = new Transform(this, comp.pathID, comp.classID1, comp.classID2);
                 ReplaceSubfile(index, trans, comp);
                 trans.LoadFrom(stream);
                 return trans;
             }
         }
     }
     catch
     {
         Report.ReportLog("Failed to load " + comp.classID1 + "/" + comp.classID2 + " PathID=" + comp.pathID);
         foreach (NotLoaded notLoaded in RemovedList)
         {
             if (notLoaded == comp)
             {
                 RemovedList.Remove(notLoaded);
                 Components.RemoveAt(index);
                 notLoaded.replacement = null;
                 Components.Insert(index, notLoaded);
                 break;
             }
         }
     }
     return null;
 }
Ejemplo n.º 4
0
        public dynamic LoadComponent(Stream stream, int index, NotLoaded comp)
        {
            stream.Position = comp.offset;
            try
            {
                switch (comp.classID1)
                {
                case UnityClassID.AnimationClip:
                {
                    AnimationClip animationClip = new AnimationClip(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, animationClip, comp);
                    animationClip.LoadFrom(stream);
                    return(animationClip);
                }

                case UnityClassID.Animator:
                {
                    Animator animator = new Animator(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, animator, comp);
                    animator.LoadFrom(stream);
                    return(animator);
                }

                case UnityClassID.AnimatorController:
                {
                    AnimatorController animatorController = new AnimatorController(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, animatorController, comp);
                    animatorController.LoadFrom(stream);
                    return(animatorController);
                }

                case UnityClassID.AssetBundle:
                {
                    AssetBundle assetBundle = new AssetBundle(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, assetBundle, comp);
                    assetBundle.LoadFrom(stream);
                    return(assetBundle);
                }

                case UnityClassID.AudioClip:
                {
                    if (loadingReferencials)
                    {
                        return(comp);
                    }
                    AudioClip ac = new AudioClip(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, ac, comp);
                    ac.LoadFrom(stream);
                    return(ac);
                }

                case UnityClassID.AudioListener:
                {
                    AudioListener audioListener = new AudioListener(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, audioListener, comp);
                    audioListener.LoadFrom(stream);
                    return(audioListener);
                }

                case UnityClassID.AudioSource:
                {
                    AudioSource audioSrc = new AudioSource(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, audioSrc, comp);
                    audioSrc.LoadFrom(stream);
                    return(audioSrc);
                }

                case UnityClassID.Avatar:
                {
                    if (loadingReferencials)
                    {
                        return(comp);
                    }
                    Avatar avatar = new Avatar(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, avatar, comp);
                    avatar.LoadFrom(stream);
                    return(avatar);
                }

                case UnityClassID.BoxCollider:
                {
                    BoxCollider boxCol = new BoxCollider(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, boxCol, comp);
                    boxCol.LoadFrom(stream);
                    return(boxCol);
                }

                case UnityClassID.Camera:
                {
                    Camera camera = new Camera(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, camera, comp);
                    camera.LoadFrom(stream);
                    return(camera);
                }

                case UnityClassID.CapsuleCollider:
                {
                    CapsuleCollider capsuleCol = new CapsuleCollider(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, capsuleCol, comp);
                    capsuleCol.LoadFrom(stream);
                    return(capsuleCol);
                }

                case UnityClassID.Cubemap:
                {
                    Cubemap cubemap = new Cubemap(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, cubemap, comp);
                    cubemap.LoadFrom(stream);
                    Parser.Textures.Add(cubemap);
                    return(cubemap);
                }

                case UnityClassID.EllipsoidParticleEmitter:
                {
                    EllipsoidParticleEmitter ellipsoid = new EllipsoidParticleEmitter(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, ellipsoid, comp);
                    ellipsoid.LoadFrom(stream);
                    return(ellipsoid);
                }

                case UnityClassID.FlareLayer:
                {
                    FlareLayer flareLayer = new FlareLayer(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, flareLayer, comp);
                    flareLayer.LoadFrom(stream);
                    return(flareLayer);
                }

                case UnityClassID.Light:
                {
                    Light light = new Light(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, light, comp);
                    light.LoadFrom(stream);
                    return(light);
                }

                case UnityClassID.LinkToGameObject:
                {
                    LinkToGameObject link = new LinkToGameObject(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, link, comp);
                    link.LoadFrom(stream);
                    return(link);
                }

                case UnityClassID.LinkToGameObject223:
                {
                    LinkToGameObject223 link = new LinkToGameObject223(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, link, comp);
                    link.LoadFrom(stream);
                    return(link);
                }

                case UnityClassID.LinkToGameObject225:
                {
                    LinkToGameObject225 link = new LinkToGameObject225(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, link, comp);
                    link.LoadFrom(stream);
                    return(link);
                }

                case UnityClassID.GameObject:
                {
                    GameObject gameObj = new GameObject(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, gameObj, comp);
                    gameObj.LoadFrom(stream);
                    return(gameObj);
                }

                case UnityClassID.Material:
                {
                    Material mat = new Material(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, mat, comp);
                    mat.LoadFrom(stream);
                    return(mat);
                }

                case UnityClassID.Mesh:
                {
                    if (loadingReferencials)
                    {
                        return(comp);
                    }
                    Mesh mesh = new Mesh(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, mesh, comp);
                    mesh.LoadFrom(stream);
                    return(mesh);
                }

                case UnityClassID.MeshCollider:
                {
                    MeshCollider meshCol = new MeshCollider(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, meshCol, comp);
                    meshCol.LoadFrom(stream);
                    return(meshCol);
                }

                case UnityClassID.MeshFilter:
                {
                    MeshFilter meshFilter = new MeshFilter(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, meshFilter, comp);
                    meshFilter.LoadFrom(stream);
                    return(meshFilter);
                }

                case UnityClassID.MeshRenderer:
                {
                    MeshRenderer meshRenderer = new MeshRenderer(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, meshRenderer, comp);
                    meshRenderer.LoadFrom(stream);
                    return(meshRenderer);
                }

                default:
                    if (comp.classID2 == UnityClassID.MonoBehaviour)
                    {
                        if (Types.Count > 0)
                        {
                            MonoBehaviour monoBehaviour = new MonoBehaviour(this, comp.pathID, comp.classID1, comp.classID2);
                            ReplaceSubfile(index, monoBehaviour, comp);
                            monoBehaviour.LoadFrom(stream);
                            return(monoBehaviour);
                        }
                        else
                        {
                            string message = comp.classID2 + " unhandled because of absence of Types in Cabinet (*.assets)";
                            if (!reported.Contains(message))
                            {
                                Report.ReportLog(message);
                                reported.Add(message);
                            }
                            return(comp);
                        }
                    }
                    else
                    {
                        string message = "Unhandled class: " + comp.classID1 + "/" + comp.classID2;
                        if (!reported.Contains(message))
                        {
                            Report.ReportLog(message);
                            reported.Add(message);
                        }
                    }
                    break;

                case UnityClassID.MonoScript:
                {
                    if (loadingReferencials)
                    {
                        return(comp);
                    }
                    MonoScript monoScript = new MonoScript(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, monoScript, comp);
                    monoScript.LoadFrom(stream);
                    return(monoScript);
                }

                case UnityClassID.MultiLink:
                {
                    MultiLink multi = new MultiLink(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, multi, comp);
                    multi.LoadFrom(stream);
                    return(multi);
                }

                case UnityClassID.ParticleAnimator:
                {
                    ParticleAnimator particleAnimator = new ParticleAnimator(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, particleAnimator, comp);
                    particleAnimator.LoadFrom(stream);
                    return(particleAnimator);
                }

                case UnityClassID.ParticleRenderer:
                {
                    ParticleRenderer particleRenderer = new ParticleRenderer(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, particleRenderer, comp);
                    particleRenderer.LoadFrom(stream);
                    return(particleRenderer);
                }

                case UnityClassID.ParticleSystem:
                {
                    ParticleSystem particleSystem = new ParticleSystem(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, particleSystem, comp);
                    particleSystem.LoadFrom(stream);
                    return(particleSystem);
                }

                case UnityClassID.ParticleSystemRenderer:
                {
                    ParticleSystemRenderer particleSystemRenderer = new ParticleSystemRenderer(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, particleSystemRenderer, comp);
                    particleSystemRenderer.LoadFrom(stream);
                    return(particleSystemRenderer);
                }

                case UnityClassID.Projector:
                {
                    Projector projector = new Projector(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, projector, comp);
                    projector.LoadFrom(stream);
                    return(projector);
                }

                case UnityClassID.Rigidbody:
                {
                    RigidBody rigidBody = new RigidBody(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, rigidBody, comp);
                    rigidBody.LoadFrom(stream);
                    return(rigidBody);
                }

                case UnityClassID.Shader:
                {
                    Shader shader = new Shader(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, shader, comp);
                    shader.LoadFrom(stream);
                    return(shader);
                }

                case UnityClassID.SkinnedMeshRenderer:
                {
                    SkinnedMeshRenderer sMesh = new SkinnedMeshRenderer(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, sMesh, comp);
                    sMesh.LoadFrom(stream);
                    return(sMesh);
                }

                case UnityClassID.SphereCollider:
                {
                    SphereCollider sphereCol = new SphereCollider(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, sphereCol, comp);
                    sphereCol.LoadFrom(stream);
                    return(sphereCol);
                }

                case UnityClassID.Sprite:
                {
                    Sprite sprite = new Sprite(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, sprite, comp);
                    sprite.LoadFrom(stream);
                    return(sprite);
                }

                case UnityClassID.SpriteRenderer:
                {
                    SpriteRenderer spriteRenderer = new SpriteRenderer(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, spriteRenderer, comp);
                    spriteRenderer.LoadFrom(stream);
                    return(spriteRenderer);
                }

                case UnityClassID.TextAsset:
                {
                    if (loadingReferencials)
                    {
                        return(comp);
                    }
                    TextAsset ta = new TextAsset(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, ta, comp);
                    ta.LoadFrom(stream);
                    return(ta);
                }

                case UnityClassID.Texture2D:
                {
                    if (loadingReferencials)
                    {
                        return(comp);
                    }
                    Texture2D tex = new Texture2D(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, tex, comp);
                    tex.LoadFrom(stream);
                    Parser.Textures.Add(tex);
                    return(tex);
                }

                case UnityClassID.Transform:
                {
                    Transform trans = new Transform(this, comp.pathID, comp.classID1, comp.classID2);
                    ReplaceSubfile(index, trans, comp);
                    trans.LoadFrom(stream);
                    return(trans);
                }
                }
            }
            catch
            {
                Report.ReportLog("Failed to load " + comp.classID1 + "/" + comp.classID2 + " PathID=" + comp.pathID);
                foreach (NotLoaded notLoaded in RemovedList)
                {
                    if (notLoaded == comp)
                    {
                        RemovedList.Remove(notLoaded);
                        Components.RemoveAt(index);
                        notLoaded.replacement = null;
                        Components.Insert(index, notLoaded);
                        break;
                    }
                }
            }
            return(null);
        }