예제 #1
0
        static void BuildAndroid()
        {
            var list = CollectAllAtlas();
            var i    = 0;

            foreach (var atlas in list)
            {
                if (null == atlas)
                {
                    Debug.LogError("null atlas " + i);
                    continue;
                }
                var instanceID   = atlas.gameObject.GetInstanceID();
                var path         = AssetDatabase.GetAssetPath(instanceID);
                var alphaMatPath = path.Replace(".prefab", ETC1Tools.AlphaAttachString + ".mat");
                if (!File.Exists(alphaMatPath))
                {
                    ETC1Tools.GenerateAlphaResources(atlas);
                }
                else
                {
                    ETC1Tools.SetAtlasToAlphaSetting(atlas);
                }
                i++;
            }
            AssetDatabase.Refresh();
            AssetDatabase.SaveAssets();
        }
예제 #2
0
        static void SplitAlpha()
        {
            var obj  = Selection.activeObject;
            var path = AssetDatabase.GetAssetPath(obj);
            var go   = AssetDatabase.LoadAssetAtPath(path, typeof(GameObject)) as GameObject;

            if (null == go)
            {
                EditorUtility.DisplayDialog("error ", "please select a atlas prefab ", "OK");
                return;
            }
            var atlas = go.GetComponent <UIAtlas>();

            if (null == atlas)
            {
                EditorUtility.DisplayDialog("error ", "please select a atlas prefab ", "OK");
                return;
            }
            ETC1Tools.GenerateAlphaResources(atlas);
        }
예제 #3
0
        static void BuildIOS()
        {
            var list = CollectAllAtlas();

            foreach (var atlas in list)
            {
                var instanceID    = atlas.gameObject.GetInstanceID();
                var path          = AssetDatabase.GetAssetPath(instanceID);
                var normalMatPath = path.Replace(".prefab", ".mat");
                var texPath       = path.Replace(".prefab", ".png");
                if (!File.Exists(normalMatPath))
                {
                    Debug.LogError("NANI ?? !!!");
                }
                else
                {
                    ETC1Tools.SetAtlasToIOSSetting(atlas);
                }
            }
            AssetDatabase.Refresh();
            AssetDatabase.SaveAssets();
        }