示例#1
0
        private void get_all_meshes(string filename)
        {
            string combined     = meshGet + "/" + filename;
            string toBeSearched = "Resources/";
            string placeToLoad  = combined.Substring(combined.IndexOf(toBeSearched) + toBeSearched.Length);

            Mesh[] meshes = Resources.LoadAll <Mesh>(placeToLoad);

            int mesh_count = meshes.Length;

            if (mesh_count > 0)
            {
                Desysia_Meshes = new Desysia_Mesh[mesh_count];
                int counter = 0;
                foreach (Mesh mesh in meshes)
                {
                    Desysia_Meshes[counter]      = new Desysia_Mesh();
                    Desysia_Meshes[counter].mesh = mesh;
                    counter++;
                }
            }
        }
示例#2
0
        private void get_all_meshes()
        {
            Component[] allFilters   = (Component[])((Component)target).gameObject.GetComponentsInChildren(typeof(MeshFilter));
            Component[] allRenderers = (Component[])((Component)target).gameObject.GetComponentsInChildren(typeof(SkinnedMeshRenderer));
            int         mesh_count   = allFilters.Length + allRenderers.Length;

            if (mesh_count > 0)
            {
                Desysia_Meshes = new Desysia_Mesh[mesh_count];
                int counter = 0;
                foreach (Component child in allFilters)
                {
                    Desysia_Meshes[counter]      = new Desysia_Mesh();
                    Desysia_Meshes[counter].mesh = ((MeshFilter)child).sharedMesh;
                    counter++;
                }
                foreach (Component child in allRenderers)
                {
                    Desysia_Meshes[counter]      = new Desysia_Mesh();
                    Desysia_Meshes[counter].mesh = ((SkinnedMeshRenderer)child).sharedMesh;
                    counter++;
                }
            }
        }