Beispiel #1
0
        //武器材质添加mjhx/item shader文件
        private void postprocessItemMaterial(string id)
        {
            var dir = UnityPath.GetProjectPath(assetPath.Replace(id + ".FBX", "Materials"));

            foreach (var file in Directory.GetFiles(dir))
            {
                if (!file.EndsWith(".mat"))
                {
                    return;
                }
                var materialPath = UnityPath.GetProjectRelativePath(file);
                var material     = (Material)AssetDatabase.LoadMainAssetAtPath(materialPath);
                material.shader = Shader.Find("Mjhx/Item");
                material.color  = Color.white;
            }
        }
        private void processAnimation(Match match)
        {
            var dir  = match.Result("${dir}");
            var file = match.Result("${file}");

            var prefabDir = UnityPath.GetProjectPath(string.Format("MjhxResource/Character/{0}", dir));

            if (!Directory.Exists(prefabDir))
            {
                Directory.CreateDirectory(prefabDir);
                AssetDatabase.Refresh();
            }
            EditorApplication.delayCall += () =>
            {
                var obj        = (GameObject)AssetDatabase.LoadAssetAtPath(assetPath, typeof(GameObject));
                var prefabPath = string.Format("Assets/MjhxResource/Character/{0}/{1}.prefab", dir, Path.GetFileNameWithoutExtension(file));
                PrefabUtility.CreatePrefab(prefabPath, obj);
                //Object.DestroyImmediate(obj,true);
            };
        }